ClientDataSet - como clonar o conteudo

Top  Previous  Next

// Clones in series 

 

For to clones the ClientDataSet, you need to build a second ClientDataSet and calling the method CloneCursor. 

 

This code block building clones of ClientDataSet1, done some operation and after to liderate. Anything operation of insert, delete and edit executed in clones are same of ClientDataSet1. 

 

The CloneCursor is definite of the following manner: 

 

Procedure CloneCursor ( Source: TCustomClientDataSet; Reset: Boolean = False); virtual; 

 

Example 

 

In the new application, add one ClientDataSet component and link to MyBase database file (alternative of Paradox). And add one Button, with the code bellow: 

 

Var 

CDSClone: TClientDataSet; 

Begin 

CDSClone := TClientDataSet.Create(nil); 

Try 

  CDSClone.CloneCursor(ClientDataSet1, false, false); 

  // execute operations with clone... 

Finally 

  CDSCloene.Free; 

End; 

End; 

 

Run application and click in button.