Share via


CDBVariant Class

Represents a variant data type for the MFC ODBC classes.

class CDBVariant

Members

Public Constructors

Name

Description

CDBVariant::CDBVariant

Constructs a CDBVariant object.

Public Methods

Name

Description

CDBVariant::Clear

Clears the CDBVariant object.

Public Data Members

Name

Description

CDBVariant::m_dwType

Contains the data type of the currently stored value. Type DWORD.

Public Union Members

Name

Description

CDBVariant::m_boolVal

Contains a value of type BOOL.

CDBVariant::m_chVal

Contains a value of type unsigned char.

CDBVariant::m_dblVal

Contains a value of type double.

CDBVariant::m_fltVal

Contains a value of type float.

CDBVariant::m_iVal

Contains a value of type short.

CDBVariant::m_lVal

Contains a value of type long.

CDBVariant::m_pbinary

Contains a pointer to an object of type CLongBinary.

CDBVariant::m_pdate

Contains a pointer to an object of type TIMESTAMP_STRUCT.

CDBVariant::m_pstring

Contains a pointer to an object of type CString.

CDBVariant::m_pstringA

Stores a pointer to an ASCII CString object.

CDBVariant::m_pstringW

Stores a pointer to a wide CString object.

Remarks

CDBVariant does not have a base class.

CDBVariant is similar to COleVariant; however, CDBVariant does not use OLE. CDBVariant allows you to store a value without worrying about the value's data type. CDBVariant tracks the data type of the current value, which is stored in a union.

Class CRecordset utilizes CDBVariant objects in three member functions: GetFieldValue, GetBookmark, and SetBookmark. For example, GetFieldValue allows you to dynamically fetch data in a column. Because the data type of the column may not be known at run time, GetFieldValue uses a CDBVariant object to store the column's data.

Inheritance Hierarchy

CDBVariant

Requirements

Header: afxdb.h

See Also

Reference

Hierarchy Chart

CRecordset Class

CRecordset::GetFieldValue

CRecordset::GetBookmark

CRecordset::SetBookmark