(1)用给参数赋值的方式如
query1.sql.add('select * from tablename where regdate>:lastdate');
query1.parambyname('lastdate').asdatetime:=strtodate('2001-01-01');
query1.open;
(2)只适用于ACCESS
sql:='SELECT * FROM tablename WHERE time_in>=#'+formatdatetime('yyyy/mm/dd',sdt - 1)+'# '
+' AND time_out<=#'+formatdatetime('yyyy/mm/dd',edt + 1)+'# ';
(3)
在sql语句中给日期型赋值
用引号把转换成字符串的时间引起来。如
fieldname:='''+formatdatetime()+''''