แก้ไข

แชร์ผ่าน


Record Field Exchange: Using RFX

This topic explains what you do to use RFX in relation to what the framework does.

Note

This topic applies to classes derived from CRecordset in which bulk row fetching has not been implemented. If you are using bulk row fetching, bulk record field exchange (Bulk RFX) is implemented. Bulk RFX is similar to RFX. To understand the differences, see Recordset: Fetching Records in Bulk (ODBC).

The following topics contain related information:

The following table shows your role in relation to what the framework does for you.

Using RFX: You and the Framework

You The framework
Declare your recordset classes with a wizard. Specify names and data types of field data members. The wizard derives a CRecordset class and writes a DoFieldExchange override for you, including an RFX function call for each field data member.
(Optional) Manually add any needed parameter data members to the class. Manually add an RFX function call to DoFieldExchange for each parameter data member, add a call to CFieldExchange::SetFieldType for the group of parameters, and specify the total number of parameters in m_nParams. See Recordset: Parameterizing a Recordset (ODBC).
(Optional) Manually bind additional columns to field data members. Manually increment m_nFields. See Recordset: Dynamically Binding Data Columns (ODBC).
Construct an object of your recordset class. Before using the object, set the values of its parameter data members, if any. For efficiency, the framework prebinds the parameters, using ODBC. When you pass parameter values, the framework passes them to the data source. Only the parameter values are sent for requeries, unless the sort and/or filter strings have changed.
Open a recordset object using CRecordset::Open. Executes the recordset's query, binds columns to field data members of the recordset, and calls DoFieldExchange to exchange data between the first selected record and the recordset's field data members.
Scroll in the recordset using CRecordset::Move or a menu or toolbar command. Calls DoFieldExchange to transfer data to the field data members from the new current record.
Add, update, and delete records. Calls DoFieldExchange to transfer data to the data source.

See also

Record Field Exchange (RFX)
Record Field Exchange: How RFX Works
Recordset: Obtaining SUMs and Other Aggregate Results (ODBC)
CRecordset Class
CFieldExchange Class
Macros, Global Functions, and Global Variables