This documentation is archived and is not being maintained.

CDaoFieldExchange Class

Supports the DAO record field exchange (DFX) routines used by the DAO database classes.

class CDaoFieldExchange




Returns nonzero if the current operation is appropriate for the type of field being updated.


Specifies the type of recordset data member — column or parameter — represented by all subsequent calls to DFX functions until the next call to SetFieldType.




The DFX operation being performed by the current call to the recordset's DoFieldExchange member function.


A pointer to the recordset on which DFX operations are being performed.

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.

Note Note

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.

Note Note

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.


Header: afxdao.h