RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TSQLDataSet.CommandText Property

Specifies the command the dataset executes.

Pascal
property CommandText: WideString;
C++
__property BSTR 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. 

 

TDBXCommand 

TDBXCommand.CommandType 

Params 

ExecSQL 

Open 

SortFieldNames 

Fetching Metadata into a Unidirectional Dataset 

Representing the Records in a Table 

Representing the Results of a Query 

Representing the Results of a Stored Procedure 

Specifying the Command to Execute 

Accessing Schema Information 

Executing the Commands using TSQLDataSet 

Specifying the Data to Display using TSQLDataSet 

Using TSimpleDataSet

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!