Datasnap.DBClient.TCustomClientDataSet.CommandText

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property CommandText: WideString read FCommandText write SetCommandText;

C++

__property System::WideString CommandText = {read=FCommandText, write=SetCommandText};

Properties

Type Visibility Source Unit Parent
property protected
Datasnap.DBClient.pas
Datasnap.DBClient.hpp
Datasnap.DBClient TCustomClientDataSet

Description

Specifies an SQL command to be executed by the database server.

CommandText specifies what data the client dataset wants to receive from its (internal or external) provider. It is either:

  • An SQL statement (query) for the database server to execute.
  • The name of a table or stored procedure.

If the client dataset uses an internal provider, CommandText is required. On TSQLClientDataSet, the CommandType property indicates whether it represents a query, table name, or stored procedure name.

If the client dataset uses an external provider component, CommandText represents a replacement for the property that the source dataset uses to identify its data (the SQL of a query, or the name of a table or stored procedure). If the provider's Options property does not include poAllowCommandText (which, by default, it does not), then CommandText has no effect.

When CommandText is a non-empty string, its value is sent to the provider when the client dataset opens or when you call the Execute method. The specified SQL command, table, or stored procedure overrides the current value of the provider's associated dataset.

If the SQL statement takes parameters, be sure that they are in the correct order, as the provider performs parameter binding on CommandText statements by index only.

See Also


Code Examples