m_pRecordset->Open("SELECT * FROM users",_variant_t((IDispatch*)theApp.m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
这个地方,总是说
error C2065: 'theApp' : undeclared identifier
error C2228: left of '.m_pConnection' must have class/struct/union type
也引入了#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
这个地方,总是说
error C2065: 'theApp' : undeclared identifier
error C2228: left of '.m_pConnection' must have class/struct/union type
也引入了#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
解决方案 »
- 求助:视频显示
- CArray请教
- 紧急求助!关于客户端管理多UDP套接字,采用什么模型可以具备超时重发机制?
- 关于List列表的选择列问题
- 一道智力题!
- 请问我再inputpin中得到IMediaSample ,但是我用GetMediaTime或GetTime得不到当前stream time,如何可以得到stream time
- 谁有WIN32下的SIP源代码?有经济支持!
- IHTMLDocument2Ptr 和IHTMLDocument2有什么区别?
- 如何加载并显示使用资源编辑器编辑的POP菜单?
- How to capture all controls's change event in the parent window?
- VC中如何获得CUP的序列号
- 求Visual C++相关帮助文档
D:\源程序\PMI\PMICertDlg.cpp(179) : error C2146: syntax error : missing ';' before identifier ' m_pConnection'
D:\源程序\PMI\PMICertDlg.cpp(179) : error C2065: ' m_pConnection' : undeclared identifier
D:\源程序\PMI\PMICertDlg.cpp(180) : error C2228: left of '.CreateInstance' must have class/struct/union type
Error executing cl.exe.
是关于数据库连接的问题
extern C****App theApp; //把“****”换成你工程的名称就行了。
上午应付了过去,还得继续
我是想用VC访问数据库,在Stdafx.h里引入#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
然后在文件PMICertDlg.cpp中添加一个指向Connection对象的指针_ConnectionPtr m_pConnection;
再用这个指针调用函数:m_pConnection->Open("driver={SQL Server};Server=59.71.72.227;DATABASE=certlink;UID=sa;PWD="",adModeUnknown);
这些都是从网上找来的,编译就会报上而的错误,难道_ConnectionPtr 不能直接用吗?
上面这个是在哪个类中声明的?
------------------------------------------------------------------------------------------------
从上面这行代码来看,你的m_pConnection是在工程的App类中声明的。如果不是的话,按你后来说的是在类CPMICertDlg中声明的,那就用不着在它前面加theApp.来引用它了。
你先在PMICertDlg.cpp开头加上下面这句试试:extern CPMICertApp theApp;