Mapping the Data Access Object: DAO 3.1 (for ODBC Direct Data Sources)

Ken Lassesen
Microsoft Developer Network Technology Group

January 31, 1996

Click here for a diagram of the Data Access Object (DAO) in various graphics formats.

Abstract

This article presents a graphic map of the Data Access Object (DAO) object model, version 3.1,as the model applies to Open Database Connectivity (ODBC) data sources connected directly to DAO rather than to the Microsoft® Jet database engine (as was required in previous versions). This is an implementation of features found in the Visual Basic® 4.0 Remote Data Object (RDO). The map shows the new DAO 3.1 properties, methods, and child objects available when directly connected to an ODBC data source.

Data Access Object 3.1

The Data Access Object (DAO) version 3.1 object model for Open Database Connectivity (ODBC) direct data sources presented in this article is a subset of the full DAO version 3.1 object model. The objects, methods, and properties shown are those that apply only to ODBC direct data sources.

Figure 1. Relationship between Data Access Object 3.1 and other data components

DAO is available in Visual C++® and many products based on Microsoft® Visual Basic® for Applications. These products include Microsoft Excel version 5.0 and later, Microsoft Access 95, Visual Basic version 4.0, and Visual C++ version 4.0. DAO may be used from any DAO 3.0 licensed host that can call an OLE Automation server, such as Microsoft Project. For information on using DAO, see your product documentation and search the Microsoft Development Library. The bibliography directs you to some key articles. DAO has gone through several versions, as shown in Table 1.

Table 1. DAO Version Used in Various Microsoft Products

DAO version Microsoft products
1.0 Visual Basic 2.0, Visual Basic 3.0, Microsoft Access 1.1
2.0 Microsoft Access 2.0
2.5 Visual Basic 4.0 (16-bit only)
3.0 Visual Basic 4.0, Microsoft Access 95, Microsoft Excel 95, Visual C++ 4.0
3.1 Separate release for existing 3.0 hosts

Figure 2 shows the relationship between objects as described by the Object Browser and online Help files. A map serves as a good learning aid and a quick reference for developers. After producing a map, I found that it was easy to work with the object: I just post the appropriate map on my wall for quick reference, which is a lot faster than clicking objects in a Help file one by one to discover their properties and methods. For an introduction to using OLE Automation, see "Using Microsoft OLE Servers to Develop Solutions."

Because Figure 2 is unreadable online, I have included the two most common graphics formats—encapsulated PostScript™ (.EPS) and Windows® metafile (.WMF)—as well as a copy of my original Shapeware™ Visio™ version 4.0 file (.VSD). The first two formats can be opened and the maps printed across multiple pages using Microsoft Excel or a commercial graphics application such as Adobe™ PageMaker™, CorelDRAW®, or Microsoft Publisher. The original Visio file is included for those who wish to modify the diagram.

Figure 2. Map of the Data Access Object 3.1

Outdated Items

Outdated items in DAO version 2.5 are not available in this version, for example, CreateDynaset. You must replace these items in your code.

Object Definitions

The objects and collections in Figure 2 are defined in Table 2.

Table 2. Object and Collection Definitions

Object or Collection Definition
DBEngine object Is the top-level object, representing the data source—the Microsoft Jet database engine or an ODBC data source.  Contains and controls all other objects in the hierarchy of data access objects.
Workspaces collection Contains all Workspace objects of the DBEngine object.
Workspace object Defines a session in a specific environment, for example, Jet or ODBC. It contains open databases and ODBC connections and provides mechanisms for simultaneous transactions.
Databases collection Contains all open Database objects opened or created in a Workspace object.
Database object Represents an open database.
Errors collection Contains all stored Error objects, each of which pertains to a single operation involving data access objects.
Error object Contains details about each data access error thrown from a single operation.
Connections collection Contains all stored Connection objects of a Workspace.
Connection object Is a network connection to an ODBC direct data source (Microsoft Windows NT™ SQL Server, ORACLE®).
QueryDefs collection Contains all QueryDef objects in a Connection object.
QueryDef object Is a stored definition of a query. Off of a Connection object, this is the prepared statement on the ODBC source.
Parameters collection Contains all the Parameter objects of a QueryDef object.
Parameter object Is a parameter associated with a QueryDef object created from a parameter query.
Recordsets collection Contains all open Recordset objects in a Database object or in a Connection object.
Recordset object Consists of the records in a base table or the records returned from a query.
Properties collection Contains all the Property objects for a specific instance of an object.
Property object Is a built-in characteristic or a user-defined characteristic of a data access object.
Fields collection Contains all stored Field objects of a Recordset object.
Field object Is a column of data with a common data type and a common set of properties.

Bibliography

Lassesen, Ken. "Mapping the Data Access Object: DAO 3.0." (MSDN Library, Technical Articles)

Lassesen, Ken. "Using Microsoft OLE Servers to Develop Solutions." (MSDN Library, Technical Articles)