vc++ ADO问题,急!

来源:百度知道 编辑:UC知道 时间:2024/06/14 17:02:55
已经在#include “stdafx.h”中添加了#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename ("EOF", "adoEOF")

但总是出现同一个错误,
error C2146: syntax error : missing ';' before identifier 'CourseView'
error C2501: '_RecordsetPtr' : missing storage-class or type specifiers

还有这个,明明定义了,
error C2501: 'conn' : missing storage-class or type specifiers
error C2065: 'conn' : undeclared identifier

必须确认你的C盘安装了msado15.dll这个文件,另外,给一篇文章给你看看,应该能够解决你的问题。
http://hi.baidu.com/idealsoft/blog/item/d8152d03ba5773703812bb0d.html

记得ado应该包括两行
#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF", "adoEOF")
#import "C:\Program Files\Common Files\System\ado\MSJRO.DLL" no_namespace rename("EOF", "adoEOF")
而且你出现问题的文件一定要#inlcude了atdafx.h才行。
还有就是要注意确定下C:\Program Files\Common Files\System\ado文件夹下是否真有msado15.dll和MSJRO.DLL 有时他们在其他路径或者系统根本没有

跟DLL应该是没关系的。头文件的问题吧。

出现这种一堆错误的问题。你应该去找第一个报错的地方之前的代码。