Runoob Tutorial ArchiveEnglish

ADO Command Object

ADO Command Object


Command Object

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

If the query is used to retrieve data, this data will be returned as a RecordSet object. This means that the retrieved data can be manipulated using 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 stored procedures with parameters.

ProgID

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


Properties

Properties Description
ActiveConnection Sets or returns the string that contains the definition of the connection or Connection object.
CommandText Sets or returns the string value that contains the provider's command (such as SOL statement, table name, or stored procedure call). The default value is "" (zero-length string).
CommandTimeout Sets or returns a long integer value that indicates the time to wait for the command to execute (unit is seconds). 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 to save the compiled version of the command (the prepared version) before execution.
State Returns a value that describes the state of the Command object, such as open, closed, connected, executing, or retrieving data.

Method

Method Description
Cancel Cancels a method's execution.
CreateParameter Creates a new Parameter object
Execute Executes the query, SQL statement, or stored procedure in the CommandText property.

Collection

Collection Description
Parameters Contains all Parameter objects for a Command object.
Properties Contains all Property objects of a Command object.