select * from table1 where dtt>='2002-2-1 12:00:00' and dtt<='2002-2-1 18:00:00'
或者
select * from table1 where dtt between '2002-2-1 12:00:00' and '2002-2-1 18:00:00'
或者
select * from table1 where dtt between '2002-2-1 12:00:00' and '2002-2-1 18:00:00'
dtStart:='2002-2-1 12:00:00';
dtEnd:='2002-2-1 18:00:00';
sqltxt:='select * from table1 where
'(dtt>'''+datetimetostr(dtend)+''''
') and (dtt <'''+datetimetostr(dtstart)+''')')
名字为“xxx"的人
sql :select * from man where Name='xxx'
在delphi:
中写为:
commandText:='select * from man where Name='+''''+'xxx'+'''';
dbms接收到的东西为:select * from man where Name='xxx';
主要是为了保证传给dbms的东西是你想传的东西
query1.sql:='select * from man where bir>=:date1 and Bir<=;date2';
query1.params.param('date1'):=*******;
query1.params.param('date2'):=*******;
query1.open;
‘select * from myTable where dtt<='2002-1-1 13:00:00' and
dtt>='2002-1-1 6:00:00' ’;
在执行ClientDataset.open语句的时候,出错提示信息为‘标准表达式中类型不匹配’。不只是何道理?
ClientDataset.filter:='dtt <= '''+datetimetostr(dtend)+''''+
' and dtt <='''+datetimetostr(dtstart)+'''';是没问题的。
我认为filter也是sql,但为何两者本质一样,语句一样,但执行起来,commandtext就不能正常执行呢