能不能直接从ADOQuery取得?只能用DataSouce的Count来读取吗?

解决方案 »

  1.   

    With ADOQuery do
      begin
         commandText:= 'select * from test';
         Open;
         if RecordCount > 0 then ShowMessage('ok');       
      end;
      

  2.   

    var
    i:integer;
    With ADOQuery do
      begin
         close;
         sql.clear;
         sql.add('select * from test');
         Open;
         i:=0;
         first;
         if not eof then
         begin
         i:=i+1;
         next;
         end;       
      end;
    ShowMessage(inttostr(i));
           
    行不行啊?
      

  3.   

    adoquery.recordcount就是返回的条数
      

  4.   

    label1.caption:=inttostr(adoquery1.recordcount);
      

  5.   

    也可以这样写:
        Dbgrid.datasource.dataset.recordcount
     如果有错,欢迎指教...
      

  6.   

    adoquery1.recordcount
    这个很简单啊,不好吗