Understanding the DAO Object Model
The DAO object model is a collection of objects that model the structure of a relational database system. With the properties and methods provided by DAO objects, you can accomplish all of the operations necessary to manage such a system, including facilities for creating databases, defining tables, fields, and indexes, establishing relations between tables, and navigating and querying the database.
The Microsoft Jet database engine translates operations on data access objects into physical operations on the database files, handling all the mechanics of interfacing with the different supported databases.
The following drawing shows the DAO object model.
There are 15 objects in the DAO object model, as listed here.
-
DBEngine object This base DAO object holds all other objects and maintains engine options.
-
Workspace object Defines and manages the current user session. This object contains information on open databases and provides mechanisms for simultaneous transactions.
-
Database object Represents a database with at least one open connection. This can be a Microsoft Jet database or an external data source.
-
TableDef object Contains both Field and Index objects to describe the database tables.
-
QueryDef object Represents a stored SQL query statement, with zero or more parameters, maintained in a Microsoft Jet database.
-
Recordset object Represents a query result set with a cursor. DAO has five types of Recordset objects: table, dynaset, snapshot, forward-only, and dynamic.
For More Information For more information on Recordset objects, the available cursor types, and how your application can use them, see Choosing and Managing Cursors in Chapter 7 of this book.
-
Container object Represents a particular set of objects in a database for which you can assign permissions in a secure workgroup. In addition to the Container objects provided by DAO, an application may define its own Container objects (such as saved forms, modules, reports, or script macros).
-
Relation object Represents a relationship between fields in tables and queries. You can use the Relation object to create, delete, or change the type of relationship, and determine which tables supply the fields that participate, whether to enforce referential integrity, and whether to perform cascading updates and deletes.
-
Field object Represents a field in a table, query, index, relation, or recordset. A Field object contains data, and you can use it to read data from a record or write data to a record.
-
Index object Represents an index on a table in the database.
-
Parameter object Represents a value associated with a QueryDef object. Query parameters can be input, output, or both.
-
Document object Contains information about individual objects in the database (such as tables, queries, or relationships).
-
User object Represents a user account with particular access permissions.
-
Group object Represents a group of user accounts that have common access permissions in a particular workspace.
-
Error object Contains information about an error that occurred during a DAO operation. When more than one error occurs during a single DAO operation, each individual error is represented by a separate Error object.
Each Workspace object has a collection of Database objects. Each Database object represents all of the objects that might be present within an individual database. Of these objects, Recordset objects are certainly the most heavily used, providing the means to execute SQL statements and manipulate the result set. TableDef objects provide simple access to tables and their fields and indexes. The DAO object model is fairly complicated because it provides so much functionality through the Microsoft Jet engine for many different data sources.