C
cnhbclg
Unregistered / Unconfirmed
GUEST, unregistred user!
请教各位大虾:
string sbmc=this.txb_sbmc.Text;
string sqlstr="select sblb,sbmc,sbcj,sbwz,sbsl,dw,bz,ht,rksj,gxsj from kfgl_sbkc where 1=1";
if (sbmc!="")
{
sqlstr=sqlstr+" and sbmc like'%"+sbmc+"%'";
}
sqlstr=sqlstr+" order by sbmc";
现在,变量sbmc中有可能会有特殊字符:" '",就是有时候sbmc是单撇号,这是执行语句时就会出错,请问各位大虾,怎么办?谢谢指点
string sbmc=this.txb_sbmc.Text;
string sqlstr="select sblb,sbmc,sbcj,sbwz,sbsl,dw,bz,ht,rksj,gxsj from kfgl_sbkc where 1=1";
if (sbmc!="")
{
sqlstr=sqlstr+" and sbmc like'%"+sbmc+"%'";
}
sqlstr=sqlstr+" order by sbmc";
现在,变量sbmc中有可能会有特殊字符:" '",就是有时候sbmc是单撇号,这是执行语句时就会出错,请问各位大虾,怎么办?谢谢指点