provided by: 
Originally published at Internet.comOverview
This article tries to explain the class library QueryDef intended to be used instead of the classic MFC class CRecordset. CRecordset is a great class with one single exception. You have to generate/write too much code. In a project I was involved there were over 700 recordsets defined. Soon working with CRecordset became a real hassle. I wanted a simpler method to access the data from an ODBC data source.
So the design goals of this library were: 1. Eliminate the need for one recordset-one class tuple. 2. Eliminate the need for bindings and the infamous list of data members henceforth. 3. Eliminate the need to know in advance the database schema. 4. Blur the distinction between a recordset and a stored procedure with output parameters. 5. Ease the access to the recordset column information. 6. Provide automatic conversion of data wherever is needed with easy formatting. 7. Simplifying the test with the SQL null value. 8. Provide a simple notification mechanism to bind visual controls with certain events related to the recordset. 9. Compatibilty with the CRecordset class (aka support for positioned updates and inserts).
The cornerstone of the library is the class CQueryDef. This class is designed to be used directly (w/o derivation) although there is nothing stopping you using it as a base class. Basically this class represents a collection of rows and columns returned from a SQL request. The table can be as small as no rows/no columns or as large as milions of rows with 255 columns. CQueryDef uses an internal representation of the column data making it possible to hold the following data types: * String or text (this includes numeric and decimal SQL types) * Int, long or short * Float and double * Datetime, smalldatetime, timestamps * Binary data ...
Read article at Internet.com site