From RAD Studio API Documentation
Jump to: navigation, search


property CommandText: WideString read GetCommandText write SetCommandText default 0;


__property CommandText = {default=0};


Type Visibility Source Unit Parent
property published
Data.Win.ADODB TADODataSet


Specifies a command to be executed.

Data.Win.ADODB.TADODataSet.CommandText inherits from Data.Win.ADODB.TCustomADODataSet.CommandText. All content below this line refers to Data.Win.ADODB.TCustomADODataSet.CommandText.

Specifies a command to be executed.

Use CommandText to specify the command to execute using the ADO command component. CommandText is a textual representation of the command such as an SQL statement, a table name, or the name of a stored procedure to execute. The command specified in CommandText is executed when the dataset's Open method is called.

If the command includes parameters, as might be the case with an SQL statement or stored procedure, access them through the dataset's Parameters property.

with ADODataSet1 do begin
CommandType := cmdText;
CommandText := 'SELECT * FROM CustomerTable';

ADODataSet1->CommandType = cmdText;
ADODataSet1->CommandText = "SELECT * FROM CustomerTable";

Note: ADO dataset components are typically used for operating on recordsets, and so the contents of the CommandText property will usually be one that returns a result set. For commands that only perform an action and do not result in the creation of a recordset, use the TADOCommand component.

See Also