RAD Studio |  |

Determining the Source of Data
Using a dataset as the source of the data | Using an XML document as the source of the data | See Also
Collapse All

When you use a provider component, you must specify the source it uses to get the data it assembles into data packets. Depending on your version of Delphi, you can specify the source as one of the following:

- To provide the data from a dataset, use TDataSetProvider.
- To provide the data from an XML document, use TXMLTransformProvider.

Using a dataset as the source of the data

If the provider is a dataset provider (TDataSetProvider), set the DataSet property of the provider to indicate the source dataset. At design time, select from available datasets in the DataSet property drop-down list in the Object Inspector.

TDataSetProvider interacts with the source dataset using the IProviderSupport interface. This interface is introduced by TDataSet, so it is available for all datasets. However, the IProviderSupport methods implemented in TDataSet are mostly stubs that don't do anything or that raise exceptions.

The dataset classes that ship with Delphi (BDE-enabled datasets, ADO-enabled datasets, dbExpress datasets, and InterBase Express datasets) override these methods to implement the IProviderSupport interface in a more useful fashion. Client datasets don't add anything to the inherited IProviderSupport implementation, but can still be used as a source dataset as long as the ResolveToDataSet property of the provider is True.

Component writers that create their own custom descendants from TDataSet must override all appropriate IProviderSupport methods if their datasets are to supply data to a provider. If the provider only provides data packets on a read-only basis (that is, if it does not apply updates), the IProviderSupport methods implemented in TDataSet may be sufficient.

Using an XML document as the source of the data

If the provider is an XML provider, set the XMLDataFile property of the provider to indicate the source document.

XML providers must transform the source document into data packets, so in addition to indicating the source document, you must also specify how to transform that document into data packets. This transformation is handled by the provider's TransformRead property. TransformRead represents a TXMLTransform object. You can set its properties to specify what transformation to use, and use its events to provide your own input to the transformation. For more information on using XML providers, see Using an XML document as the source for a provider.

See Also

Responding to Client Data Requests

Responding to Client-generated Events

Handling Server Constraints

Responding to Client Update Requests

Controlling What Information Is Included in Data Packets

Choosing How to Apply Updates Using a Dataset Provider

Communicating with the Client Dataset

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!