复制代码 代码如下:
String searchName ="Sam";
String strSql = "select * FROM Table1 where Name like '%@Name%' ";
SqlParameter[] parameters = {
new SqlParameter("@Name", searchName)
};
复制代码 代码如下:
String searchName ="Sam";
String strSql = "select * FROM Table1 where Name like @Name ";
searchName = "%"+searchName+"%"; //注意不用加单引号,传参到Sql语句中会自动添加
SqlParameter[] parameters = {
new SqlParameter("@Name", searchName)
};
新闻热点
疑难解答
图片精选