Represents the data of the client dataset in a transportable format.
property Data: OleVariant;
Description
Data represents the client dataset’s local, in-memory copy of its data, encoded as a data packet. This is the data in the binary format used internally by the client dataset.
This data packet can originate from a provider, a file on disk, or the Data property of another client data set.
Note: To obtain a copy of the client dataset’s data as an XML data packet instead of in a binary format, use the XMLData property.
----例子
This example shows how to use the OnDataRequest event to allow a client application to pass a filter expression to the provider and then receive only the records matching the filter.
The OnDataRequest event handler of the provider looks like the following:
function TForm1.Provider1DataRequest(Sender: TObject; Input: OleVariant): OleVariant;
begin
with (Sender as TDataSetProvider) do
begin
DataSet.Filter := Input;
DataSet.Filtered := True;
DataSet.First;
Result := Data;
end;
end;
On the client side, the DataRequest method can be used to fetch the data. The DataRequest method triggers an OnDataRequest event in the Provider component and returns the result of the event handler:
procedure TForm1.Button1Click(Sender: TObject);
begin
ClientDataSet1.Data := ClientDataSet1.DataRequest(FilterEdit.Text);
end;