DAO: Creating DAO Objects
All of the MFC DAO classes, except , have member functions for creating new objects. Creation means somewhat different things for different DAO objects. Topics covered include:
The following objects have Create member functions:
In addition, some objects supply member functions for creating subordinate objects, as shown in the table “Creating DAO Objects without MFC Classes” below. MFC does not supply classes for these subordinate objects. Instead, it supplies access to them through member functions of the appropriate containing class.
Creating DAO Objects without MFC Classes
|Owning class||Creation functions|
The concept of “create” has different meanings for different MFC DAO objects, as shown in the following table.
Meaning of Create for DAO Objects
|Database||Creates a new Microsoft Jet database; that is, creates the .MDB file on disk. This is the one object that is automatically appended to its collection upon creation.|
|Querydef||Creates a new DAO querydef object underlying the MFC querydef object. The object is not saved in the database until you call .|
|Recordset||No Create member function. Construct a recordset object (usually of a class derived from using the MFC wizards) and call its member function to run the query or open the table. This also creates a new DAO recordset object underlying the MFC recordset object.|
|Tabledef||Creates a new table in the specified database, and a DAO tabledef object to represent it. You must then add fields and possibly indexes to complete the table. The table is actually added to the database when you call .|
|Workspace||Creates a new DAO workspace object underlying the MFC workspace object. The object is not appended to the Workspaces collection until you call .|
See Also , , , , , , , , , , , , ,