string strSql = "select * from tbl_music where musicname like '%@ii%'";//错误的
string strSql = "select * from tbl_music where musicname like '%'+@name+'%'";//正确的
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.youkuaiyun.com/duhongsheng/article/details/77250175