Should I Use DAO or ODBC?

HomeOverviewHow Do IFAQ   |  ODBC Driver List

Which set of MFC classes should you use? This depends on your needs:

Note   DAO requires additional hard disk space.

The DAO classes have the following advantages:

Here’s a summary of the key differences to help you choose:

Choosing Between MFC’s DAO and ODBC Classes

Can I... with DAO Classes? with ODBC Classes?
Access .MDB files Yes Yes
Access ODBC data sources Yes Yes
Available for 16 Bit No Yes
Available for 32 Bit Yes Yes
Database compaction Yes No
Database engine support Microsoft Jet database engine Target DBMS
DDL support Yes Only via direct ODBC calls
DML support Yes Yes
Nature of the MFC implementation “Wrapper” of DAO core functions Simplified abstraction rather than a “wrapper” of the ODBC API
Optimal for .MDB files (Microsoft Access) Any DBMS for which you have a driver, especially in client/server situations
Transaction support Per “workspace” or, for ODBC data, per database Per database

Keep in mind that the capabilities of ODBC drivers vary. See the ODBC Programmer’s Reference and the help file for your ODBC driver for more information. For information about using ODBC via DAO, see the article DAO External: Working with External Data Sources.