JavaScript EditorDhtml editor     Free javascript download 

Main Page

The MFC Application Wizard overrides the view's OnInitialUpdate and OnGetRecordset member functions. After the framework creates the frame window, document, and view, it calls OnInitialUpdate to initialize the view. OnInitialUpdate obtains a pointer to the recordset from the document. A call to the base class CView::OnInitialUpdate function opens the recordset. The following code shows this process for a CRecordView — the code for a CDaoRecordView is similar:

В CopyCode imageCopy Code
void CSectionForm::OnInitialUpdate()
   m_pSet = &GetDocument()->m_sectionSet;

When the recordset opens, it selects records. CRecordset::Open or CDaoRecordset::Open makes the first record the current record, and DDX moves data from the recordset's field data members to the corresponding form controls in the view. For more information about RFX, see Record Field Exchange (RFX). For more information about DDX, see Dialog Data Exchange and Validation. For information about the document/view creation process, see Using the Classes to Write Applications for Windows.


You should give your end users the capability to refresh the record view controls from the recordset. Without this capability, if a user changes a control's value to an illegal value, the user can be permanently stuck on the current record. To refresh the controls, you call the CWnd member function UpdateData with a parameter of FALSE.

See Also

JavaScript EditorDhtml editor     Free javascript download