怎么声明_RecordsetPtr 变量?为什么我的什么出错了呢?

B2China 2004-06-08 10:17:17
做一个数据库程序,声明一个记录集:
_RecordsetPtr pRs;

但是编译出错:

d:\oledbex\oledbexset.h(76) : error C2065: '_RecordsetPtr' : undeclared identifier
d:\oledbex\oledbexset.h(76) : error C2146: syntax error : missing ';' before identifier 'pRs'
d:\oledbex\oledbexset.h(76) : error C2065: 'pRs' : undeclared identifier
OLEDBExView.cpp

是不是要包含什么头文件或者添加什么环境?
...全文
302 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
ain2000 2004-06-14
  • 打赏
  • 举报
回复
agree
在StdAfx.h 里边加
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
nineclock 2004-06-09
  • 打赏
  • 举报
回复
#import "c:\program files\common files\system\ado\msado15.dll" \no_namespace rename ("EOF", "adoEOF")
nightfallrove 2004-06-09
  • 打赏
  • 举报
回复
CoInitialize(NULL)应该在InitInstance里面
其它的被别人说完了,
tyscon 2004-06-09
  • 打赏
  • 举报
回复
#import应该写在stdafx.h后面
申明变量在APP的头文件里面
创建实例在InitInstance()里面
悲酥清风 2004-06-09
  • 打赏
  • 举报
回复
把#inmport...加到stdafx.h的后面呢》?
B2China 2004-06-09
  • 打赏
  • 举报
回复
axiaowin(baisha):
你说的对,不创建实例,那么对象是空的(0x0000),根本就使用不了。
axiaowin 2004-06-09
  • 打赏
  • 举报
回复
创建相应的实例
例如m_pConnection.CreateInstance("ADODB.Connection");
B2China 2004-06-09
  • 打赏
  • 举报
回复
我改了一下,把:

#import "c:\program files\common files\system\ado\msado15.dll" \no_namespace \ rename ("EOF", "adoEOF")

加在...Dlg.cpp的文件头就可以了。(...代表你的工程名)
zhonglingqqxh 2004-06-08
  • 打赏
  • 举报
回复
楼上说得对,另外开始的时候,还要初始化COM的应用环境,::CoInitialize(NULL),
好像是这个函数,不久不写数据库了,记不太清了,楼主见谅!

共同学习,共同提高!
jiey 2004-06-08
  • 打赏
  • 举报
回复
缺少系统ADO支持导致:#import "c:\program files\common files\system\ado\msado15.dll" \no_namespace \ rename ("EOF", "adoEOF")
mjfhigh 2004-06-08
  • 打赏
  • 举报
回复
有没有包含头文件呀,好像要引入一个ado库的,用import语句,具体google搜索下吧,或者找本书看看吧
jiey 2004-06-08
  • 打赏
  • 举报
回复
如果你得系统不在C盘,那就灵活得改变吧。
B2China 2004-06-08
  • 打赏
  • 举报
回复
我加了:
#import "c:\program files\common files\system\ado\msado15.dll" \no_namespace \ rename ("EOF", "adoEOF")

现在的错误更是莫名其妙啊:

d:\oledbex\debug\msado15.tlh(169) : error C2011: 'LockTypeEnum' : 'enum' type redefinition

奇怪,怎么会有这个错误?

4,012

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧