Export (0) Print
Expand All
MFC
Expand Minimize

CDaoRecordset::GetFieldValue 

Call this member function to retrieve data in a recordset.


virtual void GetFieldValue(
   LPCTSTR lpszName,
   COleVariant& varValue 
);
virtual void GetFieldValue(
   int nIndex,
   COleVariant& varValue 
);
virtual COleVariant GetFieldValue(
   LPCTSTR lpszName 
);
virtual COleVariant GetFieldValue(
   int nIndex 
);

Parameters

lpszName

A pointer to a string that contains the name of a field.

varValue

A reference to a COleVariant object that will store the value of a field.

nIndex

A zero-based index of the field in the recordset's Fields collection, for lookup by index.

The two versions of GetFieldValue that return a value return a COleVariant object that contains the value of a field.

You can look up a field by name or by ordinal position.

NoteNote

It is more efficient to call one of the versions of this member function that takes a COleVariant object reference as a parameter, rather than calling a version that returns a COleVariant object. The latter versions of this function are kept for backward compatibility.

Use GetFieldValue and SetFieldValue to dynamically bind fields at run time rather than statically binding columns using the DoFieldExchange mechanism.

GetFieldValue and the DoFieldExchange mechanism can be combined to improve performance. For example, use GetFieldValue to retrieve a value that you need only on demand, and assign that call to a "More Information" button in the interface.

For related information, see the topics "Field Object" and "Value Property" in DAO Help.

Community Additions

ADD
Show:
© 2014 Microsoft