The MFC library has the following five DAO database classes.
Class | Use |
CDaoWorkspace | An interface for managing a single user's database session |
CDaoDatabase | An interface for working with a database |
CDaoRecordset | An interface for working with a set of records (such as table-type recordsets, dynaset-type recordsets, or snapshot-type recordsets) |
CDaoTableDef | An interface for manipulating a definition of a base table or an attached table |
CDaoQueryDef | An interface for querying a database |
These classes more or less wrap the COM interfaces with corresponding names. (CDaoRecordset wraps DAORecordset, for example.) The CDaoWorkspace class actually wraps two interfaces, DAOWorkspace and DAODBEngine. The MFC wrapping is fairly complete, so you need to make direct COM DAO calls only when you need access to certain database security features. If you use the MFC library, all reference counting is taken care of; if you call DAO directly, you must be sure to call Release on your interfaces.
Both AppWizard and ClassWizard fully support DAO. You can use AppWizard to generate a complete form-based application that works like EX31B in Chapter 31, and you can use ClassWizard to generate a table-specific class that is derived from CDaoRecordset.