ADO CommandObjects
Command Object
The ADO Command object is used to execute a simple query against a database. This query can perform actions such as creating, adding, retrieving, deleting, or updating records.
If the query is used to retrieve data, the data will be returned as a RecordSet object. This means 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 stored procedures with parameters.
ProgID
set objCommand=Server.CreateObject("ADODB.command")
Properties
| Property | Description |
|---|---|
| ActiveConnection | Sets or returns a string that contains a connection definition or a Connection object. |
| CommandText | Sets or returns a string value that contains a provider command (such as an SQL 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 (in seconds) to wait while executing a command. 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 (prepared) version of a command before execution. |
| State | Returns a value that describes the state of the Command object: open, closed, connecting, executing, or retrieving data. |
Methods
| Method | Description |
|---|---|
| Cancel | Cancels an execution of a method. |
| CreateParameter | Creates a new Parameter object. |
| Execute | Executes the query, SQL statement, or stored procedure in the CommandText property. |
Collections
| Collection | Description |
|---|---|
| Parameters | Contains all Parameter objects of a Command object. |
| Properties | Contains all Property objects of a Command object. |