When you use AppWizard to create a DAO database application, the only database type offered as a selection is the Microsoft Access .MDB database. Using either Access data in an .MDB file or an installable ISAM database as an attached table to an .MDB file gives your application the best performance for data retrieval and manipulation. The procedures in this tutorial assume that you are using the StdReg32.mdb file supplied on the Visual C++ distribution CD.
AppWizard lets you specify whether your database application uses a file as well as a database. The DaoEnrol application does not need a file, so it is based on the Database view without file support option in AppWizard.
Note The following procedure describes how to enter the correct values in the AppWizard Steps to create the DaoEnrol application. Many of the Steps contain choices that you will not use to create the starter files for DaoEnrol.
To create the tutorial database application
The New dialog box appears.
DAOEnrol
.In the Location box, type the name of the directory in which you want your project files stored. AppWizard creates this directory if it doesn't exist.
AppWizard creates the project directory, and the MFC AppWizard – Step 1 dialog box appears.
When you create a database application without file support, AppWizard always creates it as an SDI application.
This enables the Data Source button.
The Database Options dialog box appears.
In the MFC AppWizard – Step 6 of 6 dialog box, you can check and, if necessary, modify the default names that AppWizard creates for your program’s classes and files.
Note By default, AppWizard bases the names of classes on the project name you supply. This naming is probably fine if your application has only one recordset/record view pair. If your application has multiple recordsets and record views, it’s a good idea to change the name of the first recordset/record view pair created by AppWizard so the naming better reflects the name of the table in the data source. For DaoEnrol, you’ll modify two class names and their related header and implementation filenames, even though the tutorial uses only one recordset/record view pair.
CDaoEnrolDoc
, and change it as follows:
In the Header file box, change the header filename to DenrlDoc.h
.
In the Implementation file box, change the name to DenrlDoc.cpp
.
CDaoEnrolView
, and change it as follows:
In the Class name box, change its name to CSectionForm
.
In the Header file box, change the header filename to SectForm.h
.
In the Implementation file box, change the name to SectForm.cpp
.
The base class is CDaoRecordView.
CDaoEnrolSet
, and change it as follows
In the Class name box, change its name to CSectionSet
.
In the Header file box, change the header filename to SectSet.h
.
In the Implementation file box, change the name to SectSet.cpp
.
The base class is CDaoRecordset. The edit item is disabled to show that you can’t change it.
The New Project Information dialog box appears, summarizing the settings and features AppWizard will generate for you when it creates your project.
You might want to take a moment to examine the application type, classes, and features that AppWizard automatically provides.
AppWizard creates all necessary files and opens the project.
Use ClassView to view the classes that AppWizard just created.