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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.