Share via


The CSectionSet Recordset Class (DAO)

The following procedure describes how to view the new recordset class, CSectionSet. After examining CSectionSet, you’ll use the text editor to examine the source files for classes CSectionForm and CDaoEnrolDoc.

To examine the new recordset class

  1. In ClassView, expand the DaoEnrol folder.

    Notice the set of classes AppWizard created for you automatically to support the DaoEnrol application.

  2. From the list of classes, expand CSectionSet.

    ClassView displays all the member variables that AppWizard created, including a variable for each of the Section table’s columns. You can use ClassWizard to view how AppWizard has bound the Section table’s columns to these member variables.

  3. From the View menu, click ClassWizard.

  4. Click the Member Variables tab.

  5. In the Class name box, select CSectionSet.

    What you see in this tab corresponds to the variables displayed in ClassView. AppWizard has bound all of the table’s columns to member variables of the CSectionSet class. These member variables are called “field data members.” AppWizard names the data members automatically, based on the column names from the data source. AppWizard also assigns the correct C++ or class library data type to the data members, based on the column type. In this example, all of the columns are text columns, mapped to type CString, except the Capacity column, which is a short.

  6. Once you’ve finished examining the CSectionSet recordset class, click Cancel to exit ClassWizard.

The following figure shows the ClassWizard Column Names list.

Table Columns Mapped to Recordset Data Members

If you don’t want all of a table’s columns bound to your recordset, you can delete the recordset field data members for those columns you don’t want by selecting the data member and clicking the Delete Variable button. For the tutorial, you will need them all.

Caution   Don’t delete any fields that are part of the table’s primary key (in this case, the SectionNo and CourseID fields).

To change the name of a field data member, delete the member and add it again with the new name.