使用adoquery查询数据库纪录。如果返回空记录集系统是不会报错的, 一定是你的代码有问题。 你可以这样 if adoquery.recordcount<> then 你的代码。
我同意上层意见,我使用了这么多次,从没出现过问题的使用adoquery查询数据库纪录。如果返回空记录集系统是不会报错的, 一定是你的代码有问题。 你可以这样 if adoquery.recordcount>0 then 你的代码。
代码 adoquery.close; adoquery.sql.clear; adoquery.sql.add('select top 1 * from Disk_task where isOver = 0'); try adoquery.open; execupt adoquery.close; exit end; if not adoquery.eof then showmessage(adoquery.fieldbyname('task_name').as string); end if 关闭窗体时,如果空记录,就会返回一个错误说必须有一个记录或记录已经被删除
一定是你的代码有问题。
你可以这样
if adoquery.recordcount<> then
你的代码。
一定是你的代码有问题。
你可以这样
if adoquery.recordcount>0 then
你的代码。
adoquery.close;
adoquery.sql.clear;
adoquery.sql.add('select top 1 * from Disk_task where isOver = 0');
try
adoquery.open;
execupt
adoquery.close;
exit
end;
if not adoquery.eof then
showmessage(adoquery.fieldbyname('task_name').as string);
end if
关闭窗体时,如果空记录,就会返回一个错误说必须有一个记录或记录已经被删除
=======Try It======
解决的方法是安装Delphi5的ADO补丁。
已经解决了