C#SQL查询
当我要接收一个参数时,我可以这样写SQL:
SELECT Name, AuthorID FROM Author WHERE (Abrige = ?)
但是我要做模糊查询的话,比如我输入一个陈字要得到姓陈的所有人的资料,
那我这样写SQL是不对的:
SELECT Name, AuthorID FROM Author WHERE (Abrige LIKE ? '% ')
该怎样改呢?
谢谢!
------解决方案--------------------str sql = string.Format( "SELECT Name, AuthorID FROM Author WHERE Abrige LIKE '%
{0}% ' ", "陈 ");
上面的搞错了俄