1、如果是DATETIME类型,还可有时间字符。 2、改为:试试: +
‘where..........  and vehicle.createtime >= '+#39+FormatDateTime('YYYY-MM-DD',DateTimePicker1.DateTime)+#39+' and vehicle.createtime <= '+#39+FormatDateTime('YYYY-MM-DD',DateTimePicker2.DateTime)+#39'  '

解决方案 »

  1.   

    建议:
    var SQL,sDate1,sDate2:string;
    begin
        sDate1:=FormatDateTime('YYYY-MM-DD',DateTimePicker1.Date;
        sDate2:=FormatDateTime('YYYY-MM-DD',DateTimePicker2.Date;
        SQL:=‘select   ....    where..........  and vehicle.createtime >= '+#39+sDate1+#39+
                   ' and vehicle.createtime <= '+ #39+sDate2+#39;' 
        // ......
    end;
      

  2.   

        SQL:=‘select   ....    where..........  and vehicle.createtime >= '+#39+sDate1+#39+
                   ' and vehicle.createtime <= '+ #39+sDate2+#39; 
      

  3.   

    lyhoo163 非常感谢——真详细……。