|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Supports the DAO record field exchange (DFX) routines used by the DAO database classes.
CDaoFieldExchange does not have a base class.
Use this class if you are writing data exchange routines for custom data types; otherwise, you will not directly use this class. DFX exchanges data between the field data members of your CDaoRecordset object and the corresponding fields of the current record on the data source. DFX manages the exchange in both directions, from the data source and to the data source. See Technical Note 53 for information about writing custom DFX routines.
The DAO database classes are distinct from the MFC database classes based on Open Database Connectivity (ODBC). All DAO database class names have the "CDao" prefix. You can still access ODBC data sources with the DAO classes. In general, the MFC classes based on DAO are more capable than the MFC classes based on ODBC. The DAO-based classes can access data, including through ODBC drivers, via their own database engine. They also support Data Definition Language (DDL) operations, such as adding tables via the classes instead of having to call DAO yourself.
DAO record field exchange (DFX) is very similar to record field exchange (RFX) in the ODBC-based MFC database classes (CDatabase, CRecordset). If you understand RFX, you will find it easy to use DFX.
A CDaoFieldExchange object provides the context information needed for DAO record field exchange to take place. CDaoFieldExchange objects support a number of operations, including binding parameters and field data members and setting various flags on the fields of the current record. DFX operations are performed on recordset-class data members of types defined by the enum FieldType in CDaoFieldExchange. Possible FieldType values are:
CDaoFieldExchange::outputColumn for field data members.
CDaoFieldExchange::param for parameter data members.
The IsValidOperation member function is provided for writing your own custom DFX routines. You will use SetFieldType frequently in your CDaoRecordset::DoFieldExchange functions. For details about the DFX global functions, see Record Field Exchange Functions. For information about writing custom DFX routines for your own data types, see Technical Note 53.