tree controls to implement database access

Source: Internet
Author: User
Tags access database

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.