This documentation is archived and is not being maintained.


You need a call to SetFieldType in your recordset class's DoFieldExchange or DoBulkFieldExchange override.

void SetFieldType(
   UINT nFieldType 


A value of the enum FieldType, declared in CFieldExchange, which can be one of the following:
  • CFieldExchange::outputColumn
  • CFieldExchange::inputParam
  • CFieldExchange::param
  • CFieldExchange::outputParam
  • CFieldExchange::inoutParam


For field data members, you must call SetFieldType with a parameter of CFieldExchange::outputColumn, followed by calls to the RFX or Bulk RFX functions. If you have not implemented bulk row fetching, then ClassWizard places this SetFieldType call for you in the field map section of DoFieldExchange.

If you parameterize your recordset class, you must call SetFieldType again, outside any field map section, followed by RFX calls for all the parameter data members. Each type of parameter data member must have its own SetFieldType call. The following table distinguishes the different values you can pass to SetFieldType to represent the parameter data members of your class:

SetFieldType parameter value Type of parameter data member
CFieldExchange::inputParam Input parameter. A value that is passed into the recordset's query or stored procedure.
CFieldExchange::param Same as CFieldExchange::inputParam.
CFieldExchange::outputParam Output parameter. A return value of the recordset's stored procedure.
CFieldExchange::inoutParam Input/output parameter. A value that is passed into and returned from the recordset's stored procedure.

In general, each group of RFX function calls associated with field data members or parameter data members must be preceded by a call to SetFieldType. The nFieldType parameter of each SetFieldType call identifies the type of the data members represented by the RFX function calls that follow the SetFieldType call.

For more information about handling output and input/output parameters, see the CRecordset member function FlushResultSet. For more information about the RFX and Bulk RFX functions, see the topic Record Field Exchange Functions. For related information about bulk row fetching, see the article Recordset: Fetching Records in Bulk (ODBC).


This example shows several calls to RFX functions with accompanying calls to SetFieldType. Note that SetFieldType is called through the pFX pointer to a CFieldExchange object.

void CSections::DoFieldExchange( CFieldExchange* pFX )
   pFX->SetFieldType( CFieldExchange::outputColumn );
   RFX_Text( pFX, "CourseID", m_strCourseID );
   RFX_Text( pFX, "InstructorID", m_strInstructorID );
   RFX_Text( pFX, "RoomNo", m_strRoomNo );
   RFX_Text( pFX, "Schedule", m_strSchedule );

   // output parameter
   pFX->SetFieldType( CFieldExchange::outputParam );
   RFX_Long( pFX, "Instructor_Count", m_nCountParam );

   // input parameter
   pFX->SetFieldType( CFieldExchange::inputParam );
   RFX_Text( pFX, "Department_Name", m_strNameParam );

See Also

CFieldExchange Overview | Class Members | Hierarchy Chart | CRecordset::DoFieldExchange | CRecordset::DoBulkFieldExchange | CRecordset::FlushResultSet | Record Field Exchange Functions