Connecting a Client Dataset to Another Dataset in the Same Application

From RAD Studio
Jump to: navigation, search

Go Up to Connecting to Another Dataset

By using a provider component, you can connect TClientDataSet to another (source) dataset. The provider packages database information into transportable data packets (which can be used by client datasets) and applies updates received in delta packets (which client datasets create) back to a database server. The architecture for this is illustrated in the following figure.


This architecture represents either a single-tiered or two-tiered application, depending on whether the database server is a local database or a remote database server. The logic that manipulates database information is in the same application that implements the user interface, although isolated into a data module.

To link the client dataset to the provider, set its ProviderName property to the name of the provider component. The provider must be in the same data module as the client dataset. To link the provider to the source dataset, set its DataSet property.

Once the client dataset is linked to the provider and the provider is linked to the source dataset, these components automatically handle all the details necessary for fetching, displaying, and navigating through the database records (assuming the source dataset is connected to a database). To apply user edits back to the database, you need only call the client dataset's ApplyUpdates method.

For more information on using a client dataset with a provider, see Using a client dataset with a provider.

See Also