how to get LIKE clause to work in asp.net and mssql
- by anoob836
Hi,
I am doing a really simple query in asp.net but after I inserted the LIKE clause it stops working.
Example:
String sql = " SELECT * FROM Products WHERE ID = @MYID AND Name LIKE '%@MYNAME%' ";
SqlCommand command = new SqlCommand(sql, cn);
If I removed the LIKE it works. Hence I am thinking its to do with the '' quotes?
Thanks