将一个DataSet复制到另一个DataSet中,当我操作其中一个DataSet时,要求另一个DataSet的指针不动,怎么办,相当于传值不传地址

解决方案 »

  1.   

    ADODataSet1.Clone(ADODataset2);
    ADODataSet1.open;
    {...do something}
      

  2.   

    我的源DataSet是Tdataset类型,,没有clone函数他的来源是
    依次用控件AdoConnection,TAdoquery,TDataSource得到数据源,再用TdbGrid显示,我现在想操作这个数据源,但在操作该数据源时总会影响在表格中的显示,我现在想操作他但不影响显示
    ,不是TADODataSet
    我是delphi初学者,帮帮忙,先谢了
      

  3.   

    那你写一个BOOKMARK,操作完了以后,再回到这个记录的位置不就行了吗?This example uses a button to copy the value of a field in the previous record into the corresponding field in the current record.procedure TForm1.CopyDataClick(Sender: TObject);var
       SavePlace: TBook;
       PrevValue: Variant;
    begin
       withTable1 do
       begin
        { get a book so that we can return to the same record }
        SavePlace := GetBook;
        try      { move to prior record}      FindPrior;       { get the value }      PrevValue := Fields[0].Value;      {Move back to the book       this may not be the next record anymore 
          if something else is changing the dataset asynchronously }
          GotoBook(SavePlace);
          { Set the value }
          Fields[0].Value := PrevValue;
          { Free the book }
        finally
          FreeBook(SavePlace);
        end;
      end;end;