Show: Delphi C++
Display Preferences

Overriding the Dataset On the Application Server

From RAD Studio
Jump to: navigation, search

Go Up to Passing Parameters to the Source Dataset


The client datasets that are associated with a particular data access mechanism use the CommandText and CommandType properties to specify the data they represent. When using TClientDataSet, however, the data is specified by the source dataset, not the client dataset. Typically, this source dataset has a property that specifies an SQL statement to generate the data or the name of a database table or stored procedure.

If the provider allows, TClientDataSet can override the property on the source dataset that indicates what data it represents. That is, if the provider permits, the client dataset's CommandText property replaces the property on the provider's dataset that specifies what data it represents. This allows TClientDataSet to specify dynamically what data it wants to see.

By default, external provider components do not let client datasets use the CommandText value in this way. To allow TClientDataSet to use its CommandText property, you must add poAllowCommandText to the Options property of the provider. Otherwise, the value of CommandText is ignored.

Note: Never remove poAllowCommandText from the Options property of TBDEClientDataSet or TIBClientDataSet. The client dataset's Options property is forwarded to the internal provider, so removing poAllowCommandText prevents the client dataset from specifying what data to access.

The client dataset sends its CommandText string to the provider at two times:

  • When the client dataset first opens. After it has retrieved the first data packet from the provider, the client dataset does not send CommandText when fetching subsequent data packets.
  • When the client dataset sends an Execute command to provider.

To send an SQL command or to change a table or stored procedure name at any other time, you must explicitly use the IAppServer interface that is available as the AppServer property. This property represents the interface through which the client dataset communicates with its provider.

See Also

Code Examples

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance