ADO and the Command Object - Command Object in the Object Browser (Page 2 of 6 )
The command object exposes a number of properties and methods as shown in the next picture.

Before any command can be executed, there needs to be an active connection. A command is known to the program by the Name property. What and how a command can execute is set by the pair of properties CommandType and CommandText. The CommandText is a string that can be specified for the command, or it could be the name of a stored procedure -- a CommandText which is stored on the data source. The CommandTimeout with a default value of 30 seconds is the duration for which the ADO can wait for results to be returned before the operation is canceled. If a value of 0 is set, it sits up waiting indefinitely. The reason a query or an execution will timeout depends on many factors, including the CursorLocation.
CommandTypeEnum
We have come across the Enums in our previous tutorials. As with other objects, the ADO uses these enumerations (Enums) in its syntax extensively. Here are the CommandTypeEnums and what they imply. These are also listed in the Object Browser.
- adCmdText : 1
The query will not modify data. - adCmdTable: 2
The query will append the table name to "Select * from " - adCmdstoredProcedure: 4
ADO will format the query to call a stored procedure on the server. - adCmdUnknown: 8(default value)
Tries different methods until the query succeeds. - adCmdFile: 256(&H100)
Not applicable to command object. - adCmdTableDirect: 512(&p00)
Not applicable to command object.
Next: Examples using the CommandType property >>
More Database Articles
More By Jayaram Krishnaswamy