Data.Win.ADODB.TCustomADODataSet.CommandText

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type: property
Visibility: protected
Source:
Data.Win.ADODB.pas
Data.Win.ADODB.hpp
Unit: Data.Win.ADODB
Parent: TCustomADODataSet

Delphi

property CommandText: WideString read GetCommandText write SetCommandText;

C++

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

Description

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';
Open;
end;



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



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