在Delphi中用ADO连接Access数据库。
  在Access查询中可以用
    select * from customers where c_code like "S???"
  查询“S”开头的四位编码。朋友们的方法不正确:
ADODataSet1.connectionString 连接 "Microsoft.Jet.OLEDB.4.0"ADODataSet1.close;
ADODataSet1.SQL.clear;
ADODataSet1.SQL.Add('Select * from customers where c_code like ''S???''');
ADODataSet1.open;

解决方案 »

  1.   

    ADODataSet1.SQL.Add('Select * from customers where c_code like ''S???'''');
      

  2.   

    如果你的数据库连接改用ODBC看看还有这个问题吗?
      

  3.   

    ADODataSet1.SQL.Add('Select * from customers where c_code'+''''+ 'like'+'S???'+'''');
      

  4.   

    Select * from customers where c_code like +' ''S___'''
      

  5.   

    adodataset1.Close;
    adodataset1.CommandText:='select * from customers where c_code like'+#32+quotedstr(#37+'S???'+#37);
    adodataset1.Open;
    其中的quotedstr()函数是为字符串加上单引号。
      

  6.   

    哥们:
    SQL语句改成这样再试试:
    select * from customers where c_code like "S%"
      

  7.   

    Select * from customers where c_code like +' ''S___'''
    vsice(为你) 对啦