CDBVariant对象 表示用于MFC ODBC类的可变数据类型

本文介绍CDBVariant对象,一种用于MFCODBC类的可变数据类型,它可以在不关心数据类型的情况下存储值。文章还解释了CDBVariant如何被CRecordset类的成员函数如GetFieldValue使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CDBVariant对象 表示用于MFC ODBC类的可变数据类型
2010-10-21 23:59

http://msdn.microsoft.com/zh-cn/library/t7yk8s5d(v=VS.90).aspx

  CDBVariant没有基类。

  CDBVariant对象表示用于MFC ODBC类的可变数据类型。CDBVariant与COleVariant类似;不过CDBVariant不使用OLE。CDBVariant允许存储值而不必关心值的数据类型。CDBVariant跟踪保存在一个联合中的当前值数据类型。
  类CRecordset在三个成员函数中利用CDBVariant对象:GetFieldValue,GetBookmark和SetBookmark。例如GetFieldValue允许动态取一个列中的数据。因为运行时可能不知道列的数据类型,GetFieldValue使用一个CDBVariant对象来存储列的数据。

  所需头文件:#include <afxdb.h>

Data Members

m_boolVal

Contains a value of type BOOL.

m_chVal

Contains a value of type unsigned char.

m_dblVal

Contains a value of type double.

m_dwType

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

m_fltVal

Contains a value of type float.

m_iVal

Contains a value of type short.

m_lVal

Contains a value of type long.

m_pbinary

Contains a pointer to an object of type CLongBinary.

m_pdate

Contains a pointer to an object of type TIMESTAMP_STRUCT.

m_pstring

Contains a pointer to an object of type CString.

m_pstringA

Stores a pointer to an ASCII CString object.

m_pstringW

Stores a pointer to a wide CString object.

Construction

CDBVariant

Constructs a CDBVariant object.

Operations

Clear

Clears the CDBVariant object.

See Also

Concepts
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值