I intend to add the contents of the database into the tree control, and then connect with the tree control to realize the access of the database by establishing the database. The query structure is clear and easy to operate.
The methodology is described below:
1, Build database: Access database, database structure and content see the package Access file.
2, the establishment of a single document is not based on database support application engineering, view class inherits from CFormView, this program
Project name PPP, view class name is Cpppview.
3, set up the database set, the data source adopts DAO connection, inherits from CDaoRecordset, class name is Cshengset
4. Add a data source file to support DAO connection in Stdafx.h file
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdao.h> //加入行,实现本视图类对Access数据库的访问
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif
5, in the PppView.h into the dataset header file.
#include"ShengSet.h"
Define dataset class variables at the same time
public:
CShengSet *m_ShengSet;
6, in the PppDoc.h into the dataset header file.
#include"ShengSet.h"
Define dataset class variables at the same time
public:
CShengSet m_ShengSet;