RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TSQLDataSet.CommandText Property

Specifies the command the dataset executes.

Pascal
property CommandText: UnicodeString;
C++
__property UnicodeString CommandText;

The value of CommandText depends on the CommandType property:  

When CommandType is ctQuery, CommandText is an SQL statement that the dataset executes. If the statement is a SELECT statement, the SQL dataset executes the statement when it is opened. If the statement does not return a result set, the SQL dataset executes the statement when the ExecSQL method is called. 

When CommandType is ctStoredProc, CommandText is the name of a stored procedure. The SQL dataset executes the stored procedure when it is opened or when the ExecSQL method is called, depending on whether the stored procedure returns a set of records. 

When CommandType is ctTable, CommandText is the name of a table on the database server. The SQL dataset automatically generates a SELECT statement to fetch all the records on all the fields in this table, sorting by the fields listed in the SortFieldNames property. The generated statement is executed when the dataset is opened. 

If CommandText is an SQL statement that includes parameters or the name of a stored procedure that has parameters, use the Params property to supply parameter values. 

This command is passed on to the TDBXCommand.Text property. 

 

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