theCommand.CommandText() = "Select * Form Table WHERE (((Table.Text) =" + "'" + _text + "'" + "))"_text 变量使用有如下形式的值时出错。比如 _text = "Wendy's"

解决方案 »

  1.   

    你有'(单引号)啊!这样就会出错了.你把这个sql输出看一下就知道了.
    用sql要注意 ' =的一些问题啊!
      

  2.   

    你构造的语句要符合sql的标准呀
    "select * from table where " + table.text + "='" + _text + "'"
      

  3.   

    _text = @"Wendy's",这样就可以了!在很多书里面都有在字符前加@的方法!可以试下!
      

  4.   

    朋友们!我知道是Wendy's里面的'(单引号)的问题
    怎么解决这个问题呀
      

  5.   

    ' 的问题' 在这句sql中不对
    假如是asp的话,这就是注释了。
      

  6.   

    改一下:
    theCommand.CommandText() = "Select * Form Table WHERE (((Table.Text) =" + "'" +Replace( _text,"'","''") + "'" + "))"