''DateTimePicker1.DateTime''要用FormatDateTime函数转为字符串才可以。如下:SQL.Text := 'Select * From good Where date > to_date(''' + FormatDateTime('yyyy-mm-dd', DateTimePicker1.DateTime) + ''',''yyyy-mm-dd'')';
select * from good WHERE date>to_date('2009-06-24','yyyy-mm-dd')或是select * from good WHERE date>to_date('2009-06-24 00:00:00','yyyy-mm-dd HH24:MI:SS')你要保证前后的格式一致,并且,DateTimePicker1.DateTime是一个日期时间,你要转成字符串
多谢各位,刚查了全文检索,zhengmw兄已有答复如下:SQL语句改成这样(适用ORACLE,其他数据库把TO_CHAR函数换一下就可以):SQL.Add('select * from p_pur2 where TO_CHAR(pur_date,''YYYYMMDD'')>='''+FormatDatetime('YYYYMMDD',DateTimePicker1.DateTime)+''' and TO_CHAR(pur_date,''YYYYMMDD'')<='''+FormatDatetime('YYYYMMDD',DateTimePicker2.DateTime)+'''');