s:='王,之,若';
adoquery1.SQL.Add('select * from dic where word in ('''+s+''')');
为什么只能查到第一个记录'王'  而之和若都查不到呢??(数据库是access)

解决方案 »

  1.   

    可能access不支持這種形式的in查詢
      

  2.   

    s:='王,之,若';
      s:=StringReplace(s,',',''',''',[rfReplaceAll]);
      self.Caption:=('select * from dic where word in ('''+s+''')');
      

  3.   

    s:='王'',''之'',''若';
    adoquery1.SQL.Add('select * from dic where word in ('''+s+''')');
      

  4.   

    s:='''王'',''之'',''若''';
    adoquery1.SQL.Add('select * from dic where word in ('+s+')');
      

  5.   

    s:='''王'',''之'',''若''';
    adoquery1.SQL.Add('select * from dic where word in ('''+s+''')');
      

  6.   

    不知这样能不,没测试:
    adoquery1.SQL.Add('select * from dic where word in (''王'',''之'',''若'') );
      

  7.   

    不知这样能不,没测试:
    adoquery1.SQL.Add('select * from dic where word in (''王'',''之'',''若'') ' );
      

  8.   

    谢谢jinjazz 、 hanlin2004两位 ,小弟的问题已经解决.刚来这里混,第一次发帖就有很多人回答 这里的气氛不错.就是分少了点,不知道怎么再给分!!!!!!