CRecordset::m_nFields

Remarks

Contains the number of field data members in the recordset class — the number of columns selected by the recordset from the data source. The constructor for the recordset class must initialize m_nFields with the correct number. If you have not implemented bulk row fetching, ClassWizard writes this initialization for you when you use it to declare your recordset class. You can also write it manually.

The framework uses this number to manage interaction between the field data members and the corresponding columns of the current record on the data source.

Important   This number must correspond to the number of “output columns” registered in DoFieldExchange or DoBulkFieldExchange after a call to SetFieldType with the parameter CFieldExchange::outputColumn.

You can bind columns dynamically, as explained in the article “Recordset: Dynamically Binding Data Columns.” If you do so, you must increase the count in m_nFields to reflect the number of RFX or Bulk RFX function calls in your DoFieldExchange or DoBulkFieldExchange member function for the dynamically bound columns.

For more information, see the articles Recordset: Dynamically Binding Data Columns (ODBC) and Recordset: Fetching Records in Bulk (ODBC) in Visual C++ Programmer’s Guide.

Example

See the article Record Field Exchange: Using RFX in Visual C++ Programmer's Guide.

CRecordset OverviewClass MembersHierarchy Chart

See Also   CRecordset::DoFieldExchange, CRecordset::DoBulkFieldExchange, CRecordset::m_nParams, CFieldExchange::SetFieldType