Udostępnij za pośrednictwem


What Is the MFC Database Programming Model?

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 Technical Note 55. 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 using 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 data access 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 the application wizard and Add Class for creating application-specific database classes

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

  • Online documentation that includes overviews, articles about programming topics, and class reference materials

For information about these components, see ODBC and MFC.

For more information, see:

See Also

Other Resources

Data Access Frequently Asked Questions