数据库中如下:xh      cz     xm
110      0     1
110      0     2
110      0     3
sql语句:select distint xh from table where cz='0'执行的结果:adoquery.recordcount=3why????????????
为什么??

解决方案 »

  1.   

    DelPhi的BUG吧你每次取 ADOQuery1.RecordCount之前ADOQuery1.Close;
    ADOQuery1.OPen;再试试
      

  2.   

    select * from table where cz='0'
    grouop by xh
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ADOQuery1.Active :=false;
    ADOQuery1.SQL.Clear ;
    ADOQuery1.SQL.Add('select distinct xh from test where cz=''0''');
    ADOQuery1.Active :=true;
    showmessage(inttostr(ADOQuery1.RecordCount));
    end;做了个简单测试,发现不了你说的情况。