SqlParameter关于Like的传参数无效问题
2015-04-24 10:47
204 查看
[b]正确的写法(简洁版)[/b]
private void GetHandleData(string strKeyWord1, string strKeyWord2, string strKeyWord3)
{
string strSql = "select top 10 * from VW_Bookinfo where bcode like @strKeyWord1 and contacttel like @strKeyWord2 and spuname like @strKeyWord3 order by tdate desc";
SqlParameter[] param = new SqlParameter[]
{
new SqlParameter("@strKeyWord1", SqlDbType.NVarChar,50),
new SqlParameter("@strKeyWord2",SqlDbType.NVarChar,50),
new SqlParameter("@strKeyWord3", SqlDbType.NVarChar,50)
};
param[0].Value = "%" + strKeyWord1 + "%";
param[1].Value = "%" + strKeyWord2 + "%";
param[2].Value = "%" + strKeyWord3 + "%";
DataTable dt = ExecuteDataTableSql(strSql, param);
DLView.DataSource = dt;
DLView.DataBind();
}
private void GetHandleData(string strKeyWord1, string strKeyWord2, string strKeyWord3)
{
string strSql = "select top 10 * from VW_Bookinfo where bcode like @strKeyWord1 and contacttel like @strKeyWord2 and spuname like @strKeyWord3 order by tdate desc";
SqlParameter[] param = new SqlParameter[]
{
new SqlParameter("@strKeyWord1", SqlDbType.NVarChar,50),
new SqlParameter("@strKeyWord2",SqlDbType.NVarChar,50),
new SqlParameter("@strKeyWord3", SqlDbType.NVarChar,50)
};
param[0].Value = "%" + strKeyWord1 + "%";
param[1].Value = "%" + strKeyWord2 + "%";
param[2].Value = "%" + strKeyWord3 + "%";
DataTable dt = ExecuteDataTableSql(strSql, param);
DLView.DataSource = dt;
DLView.DataBind();
}
相关文章推荐
- asp.net SqlParameter关于Like的传参数无效问题
- SqlParameter关于Like的传参数无效问题
- asp.net SqlParameter关于Like的传参数无效问题
- asp.net SqlParameter关于Like的传参数无效问题(转载)
- asp.net SqlParameter关于Like的传参数无效问题
- asp.net SqlParameter关于Like的传参数无效问题
- asp.net SqlParameter关于Like的传参数无效问题(转载)
- asp.net SqlParameter关于Like的传参数无效问题
- DbParameter关于Like查询的传参数无效问题
- asp.net SqlParameter关于Like的传参数无效问题
- 关于ASP.NET回发或回调参数无效问题的解决办法
- 关于AJAX.net的一个问题:回发或回调参数无效!
- 关于回发或回调参数无效问题原因的浅析
- 关于AJAX.net的一个问题:回发或回调参数无效!
- 关于“回发或回调参数无效。”问题
- 关于mysql中的like语句带参数问题
- ADO.NET中使用SqlParameter添加参数时遇到的参数无效问题
- 关于回发或回调参数无效问题原因的剖析
- 关于“回发或回调参数无效。”问题 .
- ADO.net 关于SqlParameter 遇到Like问题如何解决