delphi中查询表中共有几条记录并在edit中显示出来

解决方案 »

  1.   

    先查询表中的记录。
    qry1.Close;
    qry1.SQL.Clear;
    qry1.SQL.Add('select * from 表名');
    qry1.Open;
    再把表的记录数量指定到EDIT中
    edt1.Text:=IntToStr(qry1.RecordCount);
      

  2.   

    1楼的查询方式,如果是上百万条数据就不能这么写
    只是取记录条数 可以用select count(id) from 表比较好
      

  3.   

    select count(1) from 表名 delphi里recordcount属性有时候返回值是-1
      

  4.   

    还是用count好些。
      

  5.   

    先查询表中的记录。
    qry1.Close;
    qry1.SQL.Clear;
    qry1.SQL.Add('select count(*) totalcount from 表名');
    qry1.Open;
    再把表的记录数量指定到EDIT中
    edt1.Text:=qry1.Fields['totalcount'].AsString;
      

  6.   

    select count(1) from 表名 把查出的结果放到数据集中
    recordcount就是查询出的条数