ADO provides two objects for managing connections with data sources (Connection and Command), two objects for managing the
data returned from a data source (Field and Recordset) and three secondary objects
(Parameters, Properties, and Errors) for managing information about
ADO.
ADO provides a quick, easy way to access data from a variety of development environments.
Command Object
It defines a specific command to execute against a data source. The Command object represents a
SQL statement or stored procedure that software executes against the data source. Use of Command objects
is optional -- data can be extracted directly from a Connection object, if desired.
The Command object has the functionality of executing commands to the database. In most cases, the Command
object is created implicitly when executing an operation against the database. You can do this with the Connection
object's Execute() method, or with the Recordset's Open method. Each of these methods takes as an argument a
"Command Text". In the novice examples on this web site, the command text is a SQL statement, as
it is likely to be most of the time. When executing a prepared SQL statement, it isn't necessary to use the Command
object explicitly.
If the query is used to retrieve data, the data will be returned as a Recordset object. This means that the retrieved
data can be manipulated by properties, collections, methods, and events of the Recordset object. The major feature of
the Command object is the ability to use stored queries and procedures with parameters.
Connection Object
It represents an open connection to a data source. The Connection object sets up a link
between your program and the data source. This object contains all of the necessary configuration information and
acts as a gateway for all of the other ADO objects. The Connection object is
mandatory -- all implementations of ADO must support it.
The Connection object is the "pipeline" of data. It contains all of the
information necessary to connect to the database, and a good number of methods as well that enable us to work with
the data, and even retrieve information about errors, or the structure of the database itself.
When a Connection object is open, it is using resources on the server that should be freed up as quickly as
possible. Therefore, while closing and destroying a Connection is handled implicitly, without any interference
from you, it is always best to explicitly open, close, and destroy the Connection object. That said, it would
seem convenient to use the Connection object to retrieve Recordsets, since the Open method of the Connection
returns a Recordset when a query returns a Recordset. In fact, creating the Connection object can be used very
effectively for queries which do not return Recordsets, such as "INSERT" "UPDATE"
or "DELETE" queries.
Recordset Object
It represents the entire set of records from a database table or the results of an executed command.
Each command execution results in a Recordset containing the results of the query. This object is a mandatory
part of ADO.
Field Object
It represents a column of data with a common data type. Each Recordset object is composed of a number of
Field objects that represent individual columns in the Recordset. This object is a mandatory feature of ADO.
Parameter Object
It represents a parameter or argument associated with a Command object based on a parameterized
query or stored procedure.Command objects may have an associated collection of Parameter
objects that provide additional information to the data source when executing the command. The Parameter collection is optional.
Error Object
It provides specific details about each ADO error. The Error object represents an error
encountered by the ADO objects, especially on the data provider.
Property Object
It represents a dynamic characteristic of an ADO object that is defined by the provider.
This object is not currently supported on UNIX.