asp.net中like 使用参数化(2009-12-01 15:34:30)
对于 普通的 select等sql语句, 正常的参数化 语句 格式: select * from profile where EmployeeID= @EmployeeID for example: string loginString = "select * from profile where EmployeeID= @EmployeeID"; but please attention to the like sql sentence: select * from profile where EmployeeID Like ‘%’ + @EmployeeID + ‘%’; The accurate search format is : Select * from profile where EmployeeID like +@EmployeeID ; So the String = "SELECT * from Box WHERE BoxID like '%' + @subString + '%'" 对本文提供了有价值的文章有:
|