RAD Studio VCL Reference
TADODataSet.CommandText Property

Specifies a command to be executed.

property CommandText: WideString;
__property BSTR CommandText;

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.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!