qryNumber.SQL.Add('select IntraLabelNo,TeamNumber from OrderRec ');
qryNumber.SQL.Add('where printed=1 and PrintDT between :P0 and dateadd(second,1,:P0)');
qryNumber.Parameters.ParamByName('P0').Value:=FormatDateTime('yyyy-mm-dd hh:nn:ss',time);MS SQL数据库,用这个查询是空的结果,为什么??这样写有什么不妥吗?
time函数出的是时间, 不包含日期.是不是用错了?!
做如下替换试试
//qryNumber.Parameters.ParamByName('P0').Value:=FormatDateTime('yyyy-mm-dd hh:nn:ss',time);qryNumber.Parameters.ParamByName('P0').Value:=FormatDateTime('yyyy-mm-dd hh:nn:ss',now);
-------------
查询间隔这么小, 有可能没有符合条件的记录.