请问s里的DELETE后的时间(入库时间>="'+s1+'") and (入库时间<="'+s2+'")'要怎么表示啊下面例子运行时程序会出错!信息是 {project project1.exe raised exception class EDBEngineError with message'General SQL error.[Microsoft][ODBC Microsoft Access driver]CDE 参数不足,期待是1。’process stopped.Use step or Run to continue.}procedure Tfm_rkqk.Button1Click(Sender: TObject);
var
   s,s1,s2:string;
    begin
    table1.Close;       s1:=datetostr(datetimepicker1.Date);
       s2:=datetostr(datetimepicker2.Date);
         s:='delete from 产品入库表 where (入库时间>="'+s1+'") and (入库时间<="'+s2+'")';
          query1.Close;
           query1.SQL.Clear;
          query1.SQL.Add(s);
         query1.ExecSQL;
        table1.Open;
能回答的高手请发小弟E-MAIL:[email protected]  多谢!

解决方案 »

  1.   

    s:='delete from 产品入库表 where (入库时间>='''+s1+''') and (入库时间<='''+s2+''')';全部改成单引号看看!
      

  2.   

    强烈同意楼上的!
    在delphi里使用两个单引号来表示一个单引号
    是没有双引号的
      

  3.   

    s:='delete from 产品入库表 where (入库时间>='''+s1+''') and (入库时间<='''+s2+''')';
    用单引号,楼上为正解
      

  4.   

    s1:='#'+datetostr(datetimepicker1.Date)+'#';
           s2:='#'+datetostr(datetimepicker2.Date)+'#'
           s:='delete from 产品入库表 where (入库时间>='+s1+') and (入库时间<='+s2+')';
      

  5.   

    s:='delete from 产品入库表 where (入库时间>="'+format('''+datetimepicker1.Date+''',''yyyy-mm-dd'')+'") and (入库时间<="'+format('''+datetimepicker2.Date+''',''yyyy-mm-dd'')+'")';
      

  6.   

    access中日期应该用#..#!
    试试小别的
      

  7.   

    (1)Delphi中调用access日期应该用#..#
    (2)从错误信息来看,也可能是ADOConnection连接错误