The CSectionSet Recordset Class

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

To examine the new recordset class

  1. In ClassView, expand Enroll classes by clicking the plus sign next to the icon.

    Examine the set of classes AppWizard created for you automatically to support the Enroll application.

  2. From the list of classes, expand CSectionSet.

    ClassView displays all of the member variables that AppWizard created for you, 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 an int.

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

The figure below shows what you see in ClassWizard’s Column Names box.

Table Columns Mapped to Recordset Data Members

Tip   For this tutorial, you will need all of the column bindings. However, in your own application, 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; from within ClassWizard, select the data member and click the Delete Variable button.

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

In your own application, if you want to change the name of a field data member, use ClassWizard to delete the member and add it again with the new name.

In the next procedure, you’ll examine the CSectionForm record view class from inside the text editor.