COXDAO Class

Overview

This class wrapps all of MFCs standard DAO classes (CDaoDatabase, CDaoTableDef, CDaoQueryDef and CDaoRecordset) into one easy to use class. All of the necessary DAO classes are created and mantained internally. The most commonly used features are exposed through this class, plus there is easy access to the internal objects if extra functionality is required. For a general DAO overview please refer to the On-Line help supplied with Visual C++.

This class is very straight forward to use and allows for common database tasks to be accomplished in only a couple lines of code. The first step is to create a database object of type COXDao. Next open the database using either the COXDao::Open or COXDao::OpenSQL commands. Once opened the database is ready for use. Once finished with the database the object can be destroyed, this closes any open database automatically. Also you can reuse the same database object multiple times, since the  COXDao::Open or COXDao::OpenSQL commands will automatically close any previously opened database.

Example

COXDao dao;
CString string;

dao.OpenSQL("c:\\MyDatabase.mdb","SELECT * from MyTable");
dao.GetField("LastName",string);