pUserSet->Open("select * from score",theApp.m_pConnection.GetInterFacePtr(),adOpenDynamic,adLockOptimistic,adCmdText);错误说:
error C2228: left of '.m_pConnection' must have class/struct/union type
error C2228: left of '.GetInterfacePtr' must have class/struct/union type
error C2664: 'Open' : cannot convert parameter 1 from 'class CString' to 'const class _variant_t &'
Reason: cannot convert from 'class CString' to 'const class _variant_t'
No constructor could take the source type, or constructor overload resolution was ambiguous
请问是什么原因啊,而且查了另外一本书也是这样用的啊
error C2228: left of '.m_pConnection' must have class/struct/union type
error C2228: left of '.GetInterfacePtr' must have class/struct/union type
error C2664: 'Open' : cannot convert parameter 1 from 'class CString' to 'const class _variant_t &'
Reason: cannot convert from 'class CString' to 'const class _variant_t'
No constructor could take the source type, or constructor overload resolution was ambiguous
请问是什么原因啊,而且查了另外一本书也是这样用的啊
解决方案 »
- 串口通信编程问题求救!!!
- 请问:cmarkup里的函数setdoc和getdoc分别什么作用啊?
- 真的不会有银弹么?如何写复杂界面?
- List Control 控件的使用??
- 重装系统后,VC出现问题
- 为什么在类视图中的类名上右键点击的时候,有的类有add windows message handle,而有的类却没有.
- winXP下用Modem上网,有什么软件能够监听所有流经本机的IP数据包或者有类似的代码?
- 通过一个类的指针给这个类的一个变量赋值,赋值后这个类就不能用了????????
- VS 2012 微软自己内部都不用就销售给中国屌丝码农当宝。
- ATL还有活头?
- 网上邻居怎样实现??
- 如何得到按钮控件的边界,在线等待,谢谢
must change to:
theApp.m_pConnection->GetInterFacePtr()
_bstr_t strRst("select * from score");
_ConnectionPtr m_pConnection;
_RecordSetPtr pUserSet;
try
{
m_pConnection.CreateInstance(__uuidof(Connection));
m_pConnection->Open(strCnn,"","",adConnectUnspecified);
pUserSet.CreateInstance(__uuidof(RecordSet));
pUserSet->Open(strRst,_variant_t((IDispatch *) m_pConnection, true),adOpenKeyset,adLockOptimistic,adCmdTable);
}
catch(_com_error &e)
{
...............
}