CommandText Property

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

Settings and Return Values

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

Remarks

Use the CommandText property to set or return the text version of the query in a Command object.

The contents of the CommandText property are specific to the provider and can be standard SQL syntax or any special command format that the provider supports.

If the 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 when you call the Execute or Open methods. Depending on the CommandType property setting, ADO may alter the CommandText property during preparation or execution. After you call the Execute method, you may read the CommandText property to see if its value has changed.