关于在delphi语言中使用SQL语句查询的问题

来源:百度知道 编辑:UC知道 时间:2024/05/12 15:21:31
我的任务是将一个原数据库为access的管理软件的数据库更改为SQL Server 2000.
原程序代码如下:
begin
close;
sql.Clear;
sql.Add('select RNumber from T_DepotDetail where Pccode in (select Pccode from T_Depot where AddDate>=:a and AddDate <=:b and InorOut=:c and CustName=:d) and GoodsName=:e');
parameters.ParamByName('a').Value:=StartTime;
parameters.ParamByName('b').Value:=OverTime;
parameters.ParamByName('c').Value:='入库';
parameters.ParamByName('d').Value:=combobox1.Text;
parameters.ParamByName('e').Value:=ADOquery2.Fields[0].AsString;
open;
end;
这样的程序运行后没有查询结果,应该怎样修改?
谢谢

你可以在open前面加一句
sql.savetofile('c:\1.txt');

然后分析一下得到的sql语句,那样可以比较轻松地看出问题所在~~~

没有结果一定是没有满足条件的记录