_variant_t temp = m_pRecordset->GetCollect(mpnb);
temp.ChangeType(VT_BSTR);//把temp转化为CString对象
CString str2;
str2=temp.bstrVal;
temp.ChangeType(VT_BSTR);这句话的作用是什么啊,尤其是VT_BSTR这个参数是什么意思?
temp.ChangeType(VT_BSTR);//把temp转化为CString对象
CString str2;
str2=temp.bstrVal;
temp.ChangeType(VT_BSTR);这句话的作用是什么啊,尤其是VT_BSTR这个参数是什么意思?
解决方案 »
- 提个问题,这样怎么实现?
- 学习mfc时怎么归类记那些函数开头前的简写呢?比如:WS_/WSA_/G_等等,怎么能一看到这样的就大体知道他的功能呢?
- 在DLL中的跑线程,占CPU资源狂多,请问为什么?在线等,谢谢。
- 大家帮忙看看我显示图片时拖滚动条,图片随滚动条动的问题
- 把CView封装到ActiveX
- 组件的函数能否返回ADO的RecordSet对象
- 多线程传输文件
- 调查:现在大家用vc在做什么项目,自我感觉前景何如?
- 用DeleteString(nIndex)删除了数据以后,就不能再加入新的了?怎么办?
- VC中如何显示错误出处在哪儿?
- 以下的语名想只有 a.MC = '1'的数据取出 我写在后面后,发现a.MC 不为1的也取出了。请问怎么写
- try catch有集中形式??
void ChangeType(
VARTYPE vartype,
const _variant_t* pSrc = NULL
);
Parameters
vartype
The VARTYPE for this _variant_t object.pSrc
A pointer to the _variant_t object to be converted. If this value is NULL, conversion is done in place.Res
This member function converts a _variant_t object into the indicated VARTYPE. If pSrc is NULL, the conversion is done in place, otherwise this _variant_t object is copied from pSrc and then converted.END Microsoft Specific
.bstrVal是_variant_t类的变量吧
然后你需要一个字符串类型,但_variant_t存的不是,
调用ChangeType之后_variant_t里面存的就是BSTR类型的数据了