Use LIKE operator to retrieve data from MS Acess in C#
February 14, 2011 at 11:38 am freedom2002 Leave a comment
Both following codes are the same.
1.Do not use command parameter
string sql = “select * from table where col like \”%abc%\” “;
2.Use command parameter
string sql = “select * from table where col like ? ”;
OleDbCommand cmd = new OleDdCommand(sql, conn);
cmd.Parameters.AddWithValue(“col”, “%abc%”);
The second code seems to be the better one
!!!
Ph.
Entry filed under: programming, Tổng hợp. Tags: .
Trackback this post | Subscribe to the comments via RSS Feed