Can any Dataset component be used to link with a Client Dataset?

Can any Dataset component be used to link with a Client Dataset?

Post by vfclist » Tue, 06 Nov 2007 09:24:06


Can any Dataset component be used to provide data to a TClientDataset
component?
 
 
 

Can any Dataset component be used to link with a Client Dataset?

Post by Chau Chee » Mon, 12 Nov 2007 13:51:24

> Can any Dataset component be used to provide data to a TClientDataset

It is strange. Why can't I see your message in borland's newsgroup
using mozilla thunderbird. This message was replied by using google
group.

Ok. back to your question. The answer is yes, you can use any dataset
component to provider to a TClientDataSet.

var D: TDataSet;
CDS: TClientDataSet;
DSP: TDataSetProvider;
begin
D := TAnyDataSet.Create(nil); // change the class name
DSP := TDatasetProvider.Create(nil);
DSP.Dataset := D;
CDS := TClientDataSet.Create(nil);
try
CDS.SetProvider(DSP);
CDS.Open;
// get your CDS data from here...
finally
D.Free;
DSP.Free;
CDS.Free;
end;
end;