Title: Building Clones with ClientDataSets
Question: In this article Ill show you how to use TClientDataSet for cloning data. When you clone a ClientDataSet (CDS) exist only physics copy of data but exists two or more CDS different accessing self-data copy. The changes in CDS affect immediate a visualization of data in other CDS.
Answer:
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.