RFX_Text

void RFX_Text( CFieldExchange* pFX, const char* szName, CString& value, int nMaxLength = 255, int nColumnType = SQL_VARCHAR, short nScale = 0 );

Parameters

pFX

A pointer to an object of class CFieldExchange. This object contains information to define the context for each call of the function. For more information about the operations a CFieldExchange object can specify, see the article Record Field Exchange: How RFX Works in Visual C++ Programmer’s Guide.

szName

The name of a data column.

value

The value stored in the indicated data member — the value to be transferred. For a transfer from recordset to data source, the value, of type CString, is taken from the specified data member. For a transfer from data source to recordset, the value is stored in the specified data member.

nMaxLength

The maximum allowed length of the string or array being transferred. The default value of nMaxLength is 255. Legal values are 1 to INT_MAX. The framework allocates this amount of space for the data. For best performance, pass a value large enough to accommodate the largest data item you expect.

nColumnType

Used mainly for parameters. An integer indicating the data type of the parameter. The type is an ODBC data type of the form SQL_XXX.

nScale

Specifies the scale for values of ODBC type SQL_DECIMAL or SQL_NUMERIC. nScale is only useful when setting parameter values. For more information, see the topic "Precision, Scale, Length, and Display Size" in Appendix D of the ODBC SDK Programmer's Reference.

Remarks

The RFX_Text function transfers CString data between the field data members of a CRecordset object and columns of a record on the data source of ODBC type SQL_LONGVARCHAR, SQL_CHAR, SQL_VARCHAR, SQL_DECIMAL, or SQL_NUMERIC. Data in the data source of all of these types is mapped to and from CString in the recordset.

Example

This example shows several calls to RFX_Text. Notice also the two calls to CFieldExchange::SetFieldType. ClassWizard normally writes the second call to SetFieldType and its associated RFX calls. You must write the first call and its RFX call. It is recommended that you put any parameter items before the “//{{AFX_FIELD_MAP” comment. You must put parameters outside the comments.

//Example for RFX_Text
void CSections::DoFieldExchange(CFieldExchange* pFX)
{
   pFX->SetFieldType(CFieldExchange::inputParam);
   RFX_Text(pFX, "Name", m_strNameParam);

   //{{AFX_FIELD_MAP(CSections)
   pFX->SetFieldType(CFieldExchange::outputColumn);
   RFX_Text(pFX, "CourseID", m_strCourseID);
   RFX_Text(pFX, "InstructorID", m_strInstructorID);
   RFX_Int(pFX, "RoomNo", m_nRoomNo);
   RFX_Text(pFX, "Schedule", m_strSchedule);
   RFX_Int(pFX, "SectionNo", m_nSectionNo);
   RFX_Single(pFX, "LabFee", m_flLabFee);
   //}}AFX_FIELD_MAP
}

See Also   RFX_Bool, RFX_Long, RFX_Int, RFX_Single, RFX_Double, RFX_Date, RFX_Byte, RFX_Binary, RFX_LongBinary, CFieldExchange::SetFieldType