select distinct emp_id from timerecords where sign_time>=#'+edit1.Text+'# and sign_time<=#'+edit2.Text+'#这个语哪里有错误呀,在ACCESS里就可以查询出来,在程序里就是查询不出来,请各位高手指点,小弟都快急死了,谢谢了。

解决方案 »

  1.   

    select distinct emp_id from timerecords where sign_time>='+Quotedstr(edit1.Text)+' and sign_time<='+Quotedstr(edit2.Text);
      

  2.   

    sql server 日期为 '1991-12-12'
    Access 日期为 #1991-12-12#with adoquery1 do
    begin
     close;
     sql.text:='SELECT DISTINCT emp_id FROM timerecords WHERE sign_time>:st1 AND sign_time<=:st2';
     parameters.ParamValues['st1']:=StrToDateTime(Edit1.Text);
     parameters.ParamValues['st2']:=StrToDateTime(Edit2.Text);
     Open;
    end;楼上的那种写法也可以,看自己个人喜欢吧.