Home | Overview | How Do I | FAQ | Sample | Tutorial | ODBC Driver List
All of the MFC DAO classes, except CDaoRecordset, 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 |
CDaoDatabase | CreateRelation |
CDaoTableDef | CreateField, CreateIndex |
The concept of “create” has different meanings for different MFC DAO objects, as shown in the following table.
Meaning of Create for DAO Objects
Object | Meaning |
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 CDaoQueryDef::Append. |
Recordset | No Create member function. Construct a recordset object (usually of a class derived from CDaoRecordset using the MFC wizards) and call its Open 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 CDaoTableDef::Append. |
Workspace | Creates a new DAO workspace object underlying the MFC workspace object. The object is not appended to the Workspaces collection until you call CDaoWorkspace::Append. |
See Also CDaoWorkspace::Open, CDaoWorkspace::Close, CDaoDatabase::Open, CDaoDatabase::Close, CDaoTableDef::Open, CDaoTableDef::Close, CDaoQueryDef::Open, CDaoQueryDef::Close, CDaoRecordset::Open, CDaoRecordset::Close, CDaoDatabase::Create, CDaoQueryDef::Create, CDaoTableDef::Create, CDaoWorkspace::Create