delphi adoquery查询,如何得到查询记录数?


本文整理自网络,侵删。

 
 方法1:
 adoquery1.SQL.Clear;
  adoquery1.SQL.Add( 'select   *   from   userlist   ');
  adoquery1.Open;
  ACount:=adoquery1.RecordCount;


方法2:
var
a:integer;
begin
  adoquery1.close
  adoquery1.SQL.Clear; 
  adoquery1.SQL.Add( 'select   count(*)   from   userlist   '); 
  adoquery1.Open;
a:=adoquery1.fields[0].asinteger;
end; 

方法3:
var 
s:String;
with adoquery1 do
  begin
    Close;
    SQL.clear;
    SQL.add('select count(*) as a from userlist');
    Open;
  end;
s:=adoquery1.FieldByName('a').asstring;
Showmessage(s);

相关阅读 >>

Delphi 的链式代码

Delphi实现票据精确打印

Delphi 实现代码重启android app

Delphi线程池

Delphi编写dll(以及静态和动态方式调用)

Delphi webservices传base64字串

Delphi firemonkey的tedit七大变化

Delphi怎样读取excel表的所有字段名

Delphi ansiendstext 用法之一(路径结尾自动加\)

Delphi dbgrideh footer的设置和使用

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...