ADOQuery1.Close;
     ADOQuery1.SQL.Clear;
     with ADOQuery1 do  begin
    Close;
    SQL.Clear;
     SQL.Add('select * from table1');
    SQL.Add('where descr='''+'性别'+'''');
     Open;
  end;
  DBGrid1.datasource:=datasource1;
为什么dbgrid1里的内容仍然是整张table1的全部内容。而不是我查询出来的内容呢

解决方案 »

  1.   

    with ADOQuery1 do
    begin
    Close;
    SQL.text:='select * from table1 where descr=''性别''';
    Open;
    end;
    DBGrid1.datasource:=datasource1;
      

  2.   

    datasource1里面的dataset是不是Adoquery1啊!!
      

  3.   

    2:自动创建的表也可以被查询的.
    1:从来不用ADOQUERY,我觉得你SQL拼错了,
    select * from table1where descr='性别' 对吗? 你可以先把写好的SQL输出来看看对不对
      

  4.   


    select * from table1where descr='性别' 对吗? 你可以先把写好的SQL输出来看看对不对//////////
    可以先showmessage出来检查一下