how to get LIKE clause to work in asp.net and mssql
Posted
by anoob836
on Stack Overflow
See other posts from Stack Overflow
or by anoob836
Published on 2010-04-07T00:37:57Z
Indexed on
2010/04/07
0:43 UTC
Read the original article
Hit count: 350
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
© Stack Overflow or respective owner