Data.SqlExpr.TSQLDataSet.CommandText
Delphi
property CommandText;
C++
__property CommandText = {default=0};
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | published | Data.SqlExpr.pas Data.SqlExpr.hpp |
Data.SqlExpr | TSQLDataSet |
Description
Specifies the command the dataset executes.
Data.SqlExpr.TSQLDataSet.CommandText inherits from Data.SqlExpr.TCustomSQLDataSet.CommandText. All content below this line refers to Data.SqlExpr.TCustomSQLDataSet.CommandText.
Specifies the command the dataset executes.
The value of CommandText depends on the CommandType property, as follows:
- If CommandType is ctQuery, then 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.
- If CommandType is ctStoredProc, then 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.
- If CommandType is ctTable, then 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.
Use the Params property to supply parameter values if CommandText is either an SQL statement that includes parameters or the name of a stored procedure that has parameters.
For an example of using the CommandText field, see Mobile Tutorial: Using InterBase ToGo with dbExpress (iOS and Android). The tutorial demonstrates completing the CommandText field by supplying a string (query) rather than by using the Command Text Editor, which you can open from the Object Inspector by double-clicking the ellipsis button [...] in the value field for CommandText.