ONE Active Server Pages Product Home Page Developer Site Version


ADO Command Object CommandText Property

Contains the text of a command that you want to issue against a provider.

CommandText Property Return Values

Sets or returns a String value containing a provider command, such as an SQL statement, a table name, or a stored procedure call. Default is "" (zero-length string).

CommandText Property Remarks

Use the CommandText property to set or return the text of a Command object. Usually, this will be an SQL statement, but can also be any other type of command statement recognized by the provider, such as a stored procedure call. An SQL statement must be of the particular dialect or version supported by the provider's query processor.

If the ADO Command Object Prepared Property of the Command object is set to True and the Command object is bound to an open connection when you set the CommandText property, ADO prepares the query (that is, a compiled form of the query is stored by the provider) when you call the ADO Command Object Execute Method or ADO Connection Object Open Method methods. The Prepared property is not currently supported on UNIX.

Depending on the ADO Command Object CommandType Property setting, ADO may alter the CommandText property. You can read the CommandText property at any time to see the actual command text that ADO will use during execution.

CommandText Property Example

See the ActiveConnection property.