7.5. Data Access with ADO

Storing and retrieving data is the reason databases are employed, and a large proportion of your programming usually revolves around manipulating those objects that deal with data: views, stored procedures, and recordsets. To do this in ADO, you need some understanding of the parts of the ADO Object Model. This section discusses using ADO methods to access data.

7.5.1. Overview of the ADO Object Model

The ADO Object Model contains five main objects: the Connection, Command, Recordset, Record, and the Stream objects. Although you've already explored some examples that use the Connection object to execute actions on a data source, that's really just the beginning of the ADO functionality. These other ADO objects provide much of the rich and powerful functionality of the ADO library.

As already mentioned, the ADO Connection object stores the information that is necessary to describe the connection to an ADO data provider. It provides several methods for working with the connection, such as opening, closing, beginning transactions, committing transactions, executing commands, and so on. In general, but not always, a connection is opened to a data source when a database solution is invoked and is used to execute commands throughout the use of the Access solution.

The ADO Command object provides an interface for you to execute actions on the ADO data source. A command statement is applied to the object's CommandText or CommandStream property and the Execute ...

Get Access™ 2007 VBA Programmer's Reference now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.