ADO Command Object

Command object

The ADO Command object is used to execute a simple query-oriented database operation. This query can perform actions such as creating, adding, retrieving, deleting, or updating records.

If this query is used to retrieve data, the data will be returned as a RecordSet object. This means that the retrieved data can be manipulated by the properties, collections, methods, or events of the RecordSet object.

The main feature of the Command object is its ability to use stored queries and parameterized stored procedures.

ProgID

set objCommand=Server.CreateObject("ADODB.command")

Property

Property Description
ActiveConnection Set or return a string that defines the connection or Connection object.
CommandText Set or return a string value containing the provider command (such as SOL statement, table name, or stored procedure call). The default value is an empty string (zero-length string).
CommandTimeout Set or return a long integer value indicating the time (in seconds) for which the command is to wait before execution. The default value is 30.
CommandType Sets or returns the type of a Command Object
Name Sets or returns the name of a Command Object
Prepared Indicates whether the compiled version of the command (already prepared version) is saved before execution.
State Returns a value that describes the state of the Command Object, whether it is open, closed, connected, executed, or retrieving data.

Method

Method Description
Cancel Cancel a single execution of a method.
CreateParameter Create a new Parameter Object
Execute Execute the query, SQL statement, or stored procedure in the CommandText property.

Collection

Collection Description
Parameters All Parameter Objects containing a Command Object.
Properties All Property Objects containing a Command Object.