一个文本框输入的内容为n,j,h
查询的时间怎么办?

解决方案 »

  1.   

    string selectstr="select * from table1 where id='n\,j\,h'";
      

  2.   

    string str="select *  from T2_kjzsb where srnr like'%"+this.txtnr.Text+"%'";文本框txtnr输入的内容为n,j,h;
    数据库中有,但是,查询为什么不出现?
    谢谢大家!
      

  3.   

    //string str="select *  from T2_kjzsb where srnr like'%"+this.txtnr.Text+"%'";此句意为srnr字段中包含有完整txtnr的内容 
    就是说你输入了n,j,h  那么数据库中srnr字段的值必须是*n,j,h*  //*为任何字符串若只想匹配n,j,h中任何一个字符,如n或j  则应按","分离文本框中内容
    再进行查询
      

  4.   

    string str="select *  from T2_kjzsb where srnr like'%"+this.txtnr.Text+"%'";文本框txtnr输入的内容为n,j,h;我想查询与n,j,h匹配的任何一个字符!
    怎么写查询语句?谢谢大家!