Home | Overview | How Do I | FAQ | Sample | Tutorial | ODBC Driver List
This article explains how to use the DFX function calls that make up the body of your DoFieldExchange override.
Note This article is about the DAO version of record field exchange. If you are using the MFC ODBC classes rather than the MFC DAO classes, see the article Record Field Exchange: Using the RFX Functions instead.
The DFX global functions exchange data between columns (fields) on the data source and field data members in your recordset. Normally you use ClassWizard to write the DFX function calls in your recordset’s DoFieldExchange member function. This article describes the functions briefly and shows the data types for which DFX functions are available. Technical Note 53 describes how to write your own DFX functions for additional data types.
Each DFX function takes three parameters (and some take an optional fourth or fifth parameter):
For more information, see Record Field Exchange Functions under Macros and Globals in the Class Library Reference.
The class library supplies DFX functions for transferring many different data types between the data source and your recordsets. The following list summarizes the DFX functions by data type. In cases where you must write your own DFX function calls, select from these functions by data type.
DFX function | C++ data type | DAO data type |
DFX_Binary | CByteArray | DAO_BYTES |
DFX_Bool | BOOL | DAO_BOOL |
DFX_Byte | BYTE | DAO_BYTES |
DFX_Currency | COleCurrency | DAO_CURRENCY |
DFX_DateTime | COleDateTime | DAO_DATE |
DFX_Double | double | DAO_R8 |
DFX_Long | long | DAO_I4 |
DFX_LongBinary | CByteArray or CLongBinary* | DAO_BYTES |
DFX_Short | short | DAO_I2 |
DFX_Single | float | DAO_R4 |
DFX_Text | CString* | DAO_CHAR |
Note Mapping long binary objects, such as pictures or OLE objects, to CByteArray is now preferred over mapping them to class CLongBinary. DFX_Text maps between CString and DAO_WCHAR if the symbol _UNICODE is defined. CByteArray gives you easier control over the contents of the long binary object.
Note You can use DFX to bring data of a DAO type into a variable of a different type as long as a conversion exists between the two. Take care, however, in cases such as converting a string to a date. If the string doesn’t parse to a correct date format, an error will result.
For information about the DAO data types in the third column of the table Data Types and DFX Functions, see the topic "Type Property" in DAO Help. For more information about the DFX functions in the first column of that table, see Record Field Exchange Functions under Macros and Globals in the Class Library Reference.
Also in the Class Library Reference see CDaoRecordset and CDaoFieldExchange.
See Also DAO: Where Is..., DAO Record Field Exchange (DFX), DAO Record Field Exchange: Using DFX, DAO Record Field Exchange: Working with the Wizard Code, DAO Record Field Exchange: Using the DFX Functions, DAO Record Field Exchange: How DFX Works, DAO Queries: Filtering and Parameterizing Queries, DAO Recordset