string queryString = "SELECT * FROM Table1 WHERE Field1 LIKE ?"; OleDbCommand command = new OleDbCommand(queryString, connection); command.Parameters.Add("@p1", OleDbType.Char, 3).Value = "a"; OleDbDataReader reader = command.ExecuteReader();
For your reference:
http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbparameter.aspx
http://blogs.msdn.com/b/wriju/archive/2008/01/24/ado-net-oledbcommand-parameterized-query-sequence-rule.aspx
No comments:
Post a Comment