次の方法で共有


What Is the MFC Database Programming Model?

OverviewHow Do IFAQ   |  ODBC Driver List

Although MFC implements DAO and ODBC quite differently underneath, they have similar interfaces that it relatively easy to port your applications from one to the other, particularly from ODBC to DAO. (For information about porting from ODBC to DAO, see .) The DAO and ODBC interfaces in MFC are also very similar to that in Visual Basic.

The MFC programming model provides a database object for each open database. The database object represents your connection to the database. You make queries and updates via recordset objects. DAO provides additional objects, for working with table structure, saving queries for reuse, and so on, described later. MFC supplies classes for each of these objects: one set of classes for DAO and another set for ODBC.

Using MFC makes database programming easier. The DAO and ODBC database classes supply high-level abstractions that free you from using DAO or ODBC directly. Writing to their APIs is more complex than using the MFC classes. This is especially true if you are writing small, relatively simple applications.

The database classes add the following components to the MFC class library:

  • C++ database classes that supply a high-level API for accessing databases through either DAO or ODBC.

  • Extensions to AppWizard and ClassWizard for creating application-specific database classes.

  • Sample programs that illustrate use of the classes and the wizards.

  • Online documentation that includes overviews, tutorials, articles on programming topics, and class reference materials.

For information about these components, see this group of articles and the articles DAO and MFC and ODBC and MFC.

What do you want to know more about?