ADO and the Command Object (Page 1 of 6 )
ADO's command object can be used in several different ways to query a database. This basic tutorial presents some of these ways with examples. The Microsoft Access 2003 program is also used for the sake of the interface.
Introduction
The place of the command object in relation to the other objects in the ADO object model is shown in the next picture. The command object can query the data source and return a RecordSet Object. By providing the name of a parametrized query, or the name of a table in the database, or a stored procedure, the command object can be used to execute instructions and also return the results of the execution.
The picture shown next also shows that the Parameters collection and Parameter object are related to the Command object. While the command object can execute a query repeatedly, it can also execute multiple queries.

Properties and Methods of the Command Object
Provide a reference to ADO 2.8 library
Similar to the other articles on ADO at the ASP Free site by this author, MS Access 2003 will be used to look at some of the properties and methods of the command object. Before looking at any of the ADO objects, it is necessary to add a reference to the ADO library. By default, it may already have been added (ADO2.1) and it will be necessary to change it to a version higher than 2.5.
For this tutorial, the latest version (ADO 2.8) will be used as shown in the next picture. This window may be accessed by clicking on the Components drop-down menu when you click the menu item Tools when you are in the Microsoft Visual Basic screen.

Objective of the tutorial
The main objective of this basic tutorial on ADO's Command object is to show some of the ways it can be used to query the database and present each of the ways by an example. MS Access 2003 program is used basically to utilize the Microsoft Visual Basic interface it provides. Even if one does not have the VB 6.0 the MS Access program can be used to follow these examples.
Next: Command Object in the Object Browser >>
More Database Articles
More By Jayaram Krishnaswamy