类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
ACCESS中有一含日期参数A和B的查询QTb;查询的内容如下
select * from 库存表 where 开始日期>=A and 结束日期<B+1
在DELPHI中
ADOQuery.sql.clear;
ADOQuery.sql.add(select * From QTb);
通过在ADOQuery中传入日期参数
ADOQuery.Parameters.ParamByName(A).Value:= DateTimePicker1.DateTime;
ADOQuery.Parameters.ParamByName(B).Value:= DateTimePicker2.DateTime;
ADOQuery.Open;
DateTimePicker1.DateTime和DateTimePicker.DateTime都是2004-4-2结果查出了2004-4-3的记录.
这时通过检查A,B的参数值正确,还是2004-4-2;
经多次试验如传入日期参数时使用文本
ADOQuery.Parameters.ParamByName(A).Value:= Datatostr(DateTimePicker1.DateTime);
ADOQuery.Parameters.ParamByName(B).Value:= Datatostr(DateTimePicker2.DateTime);
ADOQuery.Open;
查出来的结果是正确的.
天啊这是如何回事?
网友回答: