我用的adotable  dbgrid  想按照某一个字段查询出一条信息  怎么写代码

解决方案 »

  1.   

    使用Filter ,先设置好连接字符串以及要连接得表名
    with ADOtable1 do begin
      Filtered := False;
      Filter := 'State = ' + QuotedStr('CA') + ' OR ' +
        'State = ' + QuotedStr('CA');
      Filtered := True;
    end;
      

  2.   

    Filter := 'State = ' + QuotedStr('CA') + ' OR ' +
        'State = ' + QuotedStr('CA');   这是什么意思啊?  我得根据条件搜索啊 
    比如我搜用户名为:11111   
      用adoquery是这样写  adoquery1.sql.text:='select * from 表 where 用户='''+edit1.text+'''';
       谢谢了  再写详细点吧
      

  3.   

    with ADOTable1 do
       begin
         Filtered := false;
         Filter := '用户名=''1111''';
         Filtered := true;
       end;