c#中sql语句中传递Like参数的写法
程序员文章站
2022-06-02 20:07:42
...
string strSql = "select * from tbl_music where musicname like '%@ii%'";//错误的
string strSql = "select * from tbl_music where musicname like '%'[email protected]+'%'";//正确的
SqlParameter[] p ={
new SqlParameter("@name",SqlDbType.NVarChar)
};
p[0].Value = "爱";
DataSet ds = DbHelperSQL.Query(strSql,p);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
转载自:https://blog.csdn.net/duhongsheng/article/details/77250175
推荐阅读