Ado Command
# ADO Command Object
* * *
## Command Object
The ADO Command object is used to execute a single, simple database-oriented 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 is returned as a Recordset object. This means the retrieved data can be manipulated using the properties, collections, methods, or events of the Recordset object.
A key 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 containing the connection definition or a Connection object. |
| CommandText | Sets or returns a string value containing the provider command (e.g., SQL statement, table name, or stored procedure call). Default value is "" (zero-length string). |
| CommandTimeout | Sets or returns a long integer value indicating the wait time for command execution (in seconds). 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 (prepared version) of the command is saved before execution. |
| State | Returns a value describing the state of the Command objectβe.g., open, closed, connected, executing, or retrieving data. |
## Methods
| Method | Description |
| --- | --- |
| Cancel | Cancels the execution of a method. |
| CreateParameter | Creates a new Parameter object. |
| Execute | Executes the query, SQL statement, or stored procedure specified 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. |
YouTip