Share via


ENROLL: A Sample MFC Database Application

ENROLL is an example of a Microsoft Foundation Class Library (MFC) database application. The ENROLL sample has four subdirectories, named STEP1, STEP2, STEP3 and STEP4. The first three subdirectories correspond to steps in the . STEP4, which adds more advanced features to the ENROLL database application, is not discussed in the tutorial but is discussed below.

The first three steps of ENROLL illustrate the following.

  • Code created by the AppWizard database option.

  • CRecordset and CRecordView classes.

  • Using MFC database classes in conjunction with the framework's document/view architecture.

  • Adding, updating, and deleting database records.

  • Handling database exceptions.

STEP4 of ENROLL illustrates the following.

  • Using multiple CRecordView-derived classes.

  • Switching views in a frame window.

  • Using update hints and CDocument::UpdateAllViews to coordinate multiple record views.

ENROLL STEP4 has the same user interface as ENROLL STEP3, with the addition of a new Form menu and a Course form. The Form menu lets you toggle between the Sections form and the Course form. When you add or delete a course in the Course form, the change is automatically reflected in the list of courses displayed in the dialog box in the Section form.

****Note   ****To run the ENROLL application, you must first set up the Student Registration Database and register it with ODBC. For information about how to do this, see .

The STEP1 sample demonstrates the following keywords:

CControlBar::EnableDocking; CControlBar::GetBarStyle; CControlBar::SetBarStyle; CDialog::DoModal; CDocument::OnNewDocument; CFieldExchange::SetFieldType; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CRecordView::OnGetRecordset; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CStatusBar::Create; CStatusBar::SetIndicators; CToolBar::Create; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::PreCreateWindow

The STEP2 sample demonstrates the following keywords:

CComboBox::AddString; CComboBox::GetCurSel; CComboBox::GetLBText; CComboBox::ResetContent; CComboBox::SetCurSel; CDialog::DoModal; CDocument::OnNewDocument; CFieldExchange::SetFieldType; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CRecordView::OnGetRecordset; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CRecordset::IsEOF; CRecordset::IsOpen; CRecordset::MoveNext; CRecordset::Open; CRecordset::Requery; CRecordset::SetFieldNull; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::PreCreateWindow; CWnd::UpdateData

The STEP3 sample demonstrates the following keywords:

AfxMessageBox; CComboBox::AddString; CComboBox::ResetContent; CComboBox::SetCurSel; CDialog::DoModal; CDocument::OnNewDocument; CEdit::SetReadOnly; CFieldExchange::SetFieldType; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CObject::AssertValid; CObject::Dump; CRecordView::OnGetRecordset; CRecordView::OnMove; CRecordset::AddNew; CRecordset::Delete; CRecordset::DoFieldExchange; CRecordset::GetDefaultConnect; CRecordset::GetDefaultSQL; CRecordset::IsBOF; CRecordset::IsEOF; CRecordset::IsOpen; CRecordset::Move; CRecordset::MoveLast; CRecordset::MoveNext; CRecordset::Open; CRecordset::SetFieldNull; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::DoDataExchange; CWnd::OnCreate; CWnd::PreCreateWindow; CWnd::UpdateData

The STEP4 sample demonstrates the following keywords:

AfxMessageBox; CComboBox::AddString; CComboBox::DeleteString; CComboBox::FindStringExact; CComboBox::GetCurSel; CComboBox::GetLBText; CComboBox::ResetContent; CComboBox::SetCurSel; CDatabase::IsOpen; CDialog::DoModal; CDocument::OnNewDocument; CEdit::SetReadOnly; CFieldExchange::SetFieldType; CFrameWnd::Create; CFrameWnd::DockControlBar; CFrameWnd::EnableDocking; CFrameWnd::GetActiveView; CFrameWnd::RecalcLayout; CFrameWnd::SetActiveView; CFrameWnd::rectDefault; CObject::AssertValid; CObject::Dump; CObject::GetRuntimeClass; CObject::IsKindOf; CRecordView::OnGetRecordset; CRecordView::OnMove; CRecordset::AddNew; CRecordset::Delete; CRecordset::DoFieldExchange; CRecordset::GetDefaultSQL; CRecordset::IsBOF; CRecordset::IsEOF; CRecordset::IsOpen; CRecordset::MoveLast; CRecordset::MoveNext; CRecordset::Open; CRecordset::Requery; CRecordset::SetFieldNull; CRecordset::Update; CView::DoPreparePrinting; CView::GetDocument; CView::OnBeginPrinting; CView::OnEndPrinting; CView::OnInitialUpdate; CView::OnPreparePrinting; CView::OnUpdate; CWinApp::AddDocTemplate; CWinApp::Enable3dControls; CWinApp::InitInstance; CWinApp::LoadStdProfileSettings; CWnd::Create; CWnd::DoDataExchange; CWnd::GetDlgItem; CWnd::GetWindowText; CWnd::OnCreate; CWnd::PreCreateWindow; CWnd::SetDlgCtrlID; CWnd::ShowWindow; CWnd::UpdateData