在Delphi 里,请教了(50分)

  • 主题发起人 主题发起人 chinaluo
  • 开始时间 开始时间
C

chinaluo

Unregistered / Unconfirmed
GUEST, unregistred user!
大家好,
我的这个问题是这样的,
我的ACCESS数据库加DELPHI中的时间不知怎样构造成SQL语句,请大家帮我一个忙.
sql1:='select distinct bookid from buy ';
sql1:=sql1+'where buydate<= '+buydatedatetostr( DateTimePicker1.Date);

怎样才对,,
 
sql1:='select distinct bookid from buy ';
sql1:=sql1+'where buydate<='''+datetostr( DateTimePicker1.Date)+'''';
 
sql1:=sql1+'where buydate<= '''+buydatedatetostr( DateTimePicker1.Date)'''';

 
query1.sql.add('select ... where buydate<=:');
query1.params[0].asdatetime:=datetimepicker1.date;
或者sql1:=sql1+'where buydate<= ''#'+buydatedatetostr( DateTimePicker1.Date)+'#''';

 
sql1:='select distinct bookid from buy ';
sql1:=sql1+'where buydate<=:VarDate';
Query1.Sql.Add(Sql)
Query1.Sql.ParamsByName('VarDate').AsDate:=DateTimePicker1.Date;
Query1.Oper;
 
后退
顶部