为何返回记录数是-1

zmcpu 2002-05-10 09:21:58
QUERY 查询出结果集已经显示出来,但为什么recordcount为-1?
源码如下:
with datafrm.Query2 do
begin
close;
sql.clear;
sql.Add('Select CustomerId,CustomerName,Address,Postcode,Touchman,');
sql.Add('phone,Fax,SuperiorName,BankName,AccountID,TaxID,NetAddress,Email,CustomerRemarks,TouchmanRemarks');
sql.Add (' From CustomerTable ');
sql.Add('order by customerid');
prepare;
open;
k:=recordcount;
end;
StaticText1.Caption :='符合条件的客户数量为:'+inttostr(k );
...全文
21 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
newwen 2002-05-10
  • 打赏
  • 举报
回复
BDE是这样的
macro_love 2002-05-10
  • 打赏
  • 举报
回复
Note: Use RecordCount with care, because record counting can be a costly operation, especially for SQL queries that return large result sets. Generally, an application should only use RecordCount with Paradox and dBASE tables.
你看帮助呀,recordCount只能用在哪些表中,你的表又是什么类型
tygh2000 2002-05-10
  • 打赏
  • 举报
回复
我用ado没有这种情况的,你在open后面加一个.last,再看看呢?

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧