gbrsxxtjquery_1.Close;
   gbrsxxtjquery_1.SQL.Clear ;
gbrsxxtjquery_1.sql.add('select distinct rydm from m_jbqk ');
   gbrsxxtjquery_1.Open;
   combobox1.Clear ;
   with gbrsxxtjquery_1 do
    begin
      first;
      while not (gbrsxxtjquery_1.Eof ) do
       begin
         combobox1.Items.Add(fieldbyname('rydm').asstring);
         Next;
       end;
    end;
为什么当requerylive=true是错误的?
 为什么?

解决方案 »

  1.   

    不会吧,下面是我的程序
    //Query1.RequeryLive在设计时设为true;
      Query1.Close;
      Query1.SQL.Clear;
      Query1.SQL.Add('select * from office');
      Query1.Open;
      while not Query1.Eof do
      begin
        ComboBox1.Items.Add(Query1.Fields[0].AsString);
        Query1.Next;
      end;
      

  2.   

    requerylive为TRUE时可以对结果集修改,要关闭数据集。
      

  3.   

    因为在缺省的模式下,由于你的SQL有Distinct,所以Delphi无法在Update的时候定位数据。如果你不修改,RequestLive设为False。如果你要修改数据,那么需要将CacheUpdate设为true,同时需要将其UpdateObject属性连接上一个UpdateSQL。
      

  4.   

    上面的正确,distinct 的原因