Databases Samples

MFC has two kinds of database classes: those based on Open Database Connectivity (ODBC) and those based on Data Access Objects (DAO).

DAO Database Class Samples

DAOCTL shows how to build an OLE control container which contains data-bound controls. The container provides the controls with data from an Access database via DAO

DAOENROL is a sample that is based on the ENROLL sample, but migrated to the DAO database classes. DAOENROL also functions as Step 4 of the DaoEnrol tutorial.

DAOTABLE demonstrates using the MFC Data Access Objects (DAO) database classes to create common database objects: databases, tables, queries, fields, and indexes.

DAOVIEW is a moderately sophisticated browser that lets you examine the schema of a database.

ODBC Database Class Samples

DBFETCH demonstrates the use of bulk row fetching and shows how to use the ODBC SQLSetPos API call for updating records.

ENROLL is the tutorial sample application discussed in Visual C++ Tutorials. The ENROLL sample has four subdirectories — ENROLL\STEP1, ENROLL\STEP2, ENROLL\STEP3, and ENROLL\STEP4.

The first three subdirectories correspond to the tutorial, in which the development of ENROLL is broken up into three overall steps. STEP4 is not discussed in the tutorial, but it adds more advanced features to the ENROLL database application, which are beyond the scope of the tutorial.

The DYNABIND sample illustrates dynamic binding of database columns to a recordset. The techniques demonstrated by DYNABIND are useful for adding a customer site customization capability to a database application.

ODBCINFO shows how to determine various ODBC driver capabilities at run time. ODBCINFO opens a selected ODBC data source and displays information about it in a set of property pages.

MFCROWS shows how to use COleDBRecordView to scroll through a table in a database. It also demonstrates how to use multiple accessors so you can update an Access table that contains an AutoNumber field to be retrieved.

STDREG is a tool for populating the Student Registration database, which is used by the Enroll database tutorial, in any format supported by an ODBC driver. As a sample, STDREG illustrates how to dynamically create tables and columns in a database using direct SQL.

The CATALOG sample shows the following:

CATALOG2 also lets you browse the schema of a data source, but also uses Windows Common Controls to display the information.

See Also

Microsoft Foundation Class Library Samples Index