ADO 中 _variant_t 类型转换

CString m_UserName;
_variant_t vstr = m_pRecordset->GetCollect("username");
m_UserName = vt.bstrVal;
或者
CString m_UserName;
m_UserName=(LPCTSTR)(_bstr_t)(pRst->GetCollect(L"equip_desc"));


数值类型:
int m_Age;
_variant_t vstr = m_pRecordset->GetCollect("age");
m_Age = vstr.iVal;
或者
int m_Age;
m_Age=pRst->GetCollect(L"equip_desc").intval;


日期类型:
COleDateTime m_Time;
_variant_t vstr = m_pRecordset->GetCollect("time");
m_Time = vstr.data;
或者
COleDateTime m_Time;

m_Time=pRst->GetCollect(L"equip_desc").date;


本文转至:http://kingsong1980.blog.163.com/blog/static/106011326201081024153460/


你可能感兴趣的:(GetCollect)