You can use the client dataset's Data property to assign data to a client dataset from another dataset. Data is a data packet in the form of an OleVariant. A data packet can come from another client dataset or from any other dataset by using a provider. Once a data packet is assigned to Data, its contents are displayed automatically in data-aware controls connected to the client dataset by a data source component.
When you open a client dataset that represents server data or that uses an external provider component, data packets are automatically assigned to Data.
When your client dataset does not use a provider, you can copy the data from another client dataset as follows:
ClientDataSet1.Data := ClientDataSet2.Data;
ClientDataSet1->Data = ClientDataSet2->Data;
TempProvider := TDataSetProvider.Create(Form1); TempProvider.DataSet := SourceDataSet; ClientDataSet1.Data := TempProvider.Data; TempProvider.Free;
TempProvider = new TDataSetProvider(Form1); TempProvider->DataSet = SourceDataSet; ClientDataSet1->Data = TempProvider->Data; delete TempProvider;
TempProvider := TDataSetProvider.Create(Form1); TempProvider.DataSet := ClientDataSet1; TempProvider.ApplyUpdates(SourceDataSet.Delta, -1, ErrCount); TempProvider.Free;
TempProvider = new TDataSetProvider(Form1); TempProvider->DataSet = ClientDataSet1; TempProvider->ApplyUpdates(SourceDataSet->Delta, -1, ErrCount); delete TempProvider;
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|