ADODB错误解决办法

错误如下:

MSJRO.tlh(100) : error C2146: syntax error : missing ';' before identifier 'ConflictTables'
MSJRO.tlh(100) : error C2501: '_RecordsetPtr' : missing storage-class or type specifiers
MSJRO.tlh(100) : error C2501: 'ConflictTables' : missing storage-class or type specifiers
MSJRO.tlh(128) : error C2146: syntax error : missing ';' before identifier 'GetConflictTables'
MSJRO.tlh(128) : error C2501: '_RecordsetPtr' : missing storage-class or type specifiers
MSJRO.tli(43) : error C2143: syntax error : missing ';' before 'tag::id'
MSJRO.tli(43) : error C2433: '_RecordsetPtr' : 'inline' not permitted on data declarations
MSJRO.tli(43) : error C2501: '_RecordsetPtr' : missing storage-class or type specifiers
MSJRO.tli(43) : fatal error C1004: unexpected end of file found

原来头文件相关代码是这样:
#pragma warning (disable: 4146)
// CG : In order to use this code against a different version of ADO, the appropriate
// ADO library needs to be used in the #import statement
#pragma message ("Make sure you go to Tools.Options.Directories.Library files and add the paths to msado15.dll and msjro.dll will usually be in C:\\Program Files\\Common Files\\System\\ado")
//#import "C:\Program Files\Common Files\System\ado\msado15.dll" rename("EOF", "EndOfFile")
//#import "C:\Program Files\Common Files\System\ado\MSJRO.DLL" no_namespace rename("ReplicaTypeEnum", "_ReplicaTypeEnum") 

#import <msado15.dll> rename("EOF", "EndOfFile")
#import <MSJRO.DLL> no_namespace rename("ReplicaTypeEnum", "_ReplicaTypeEnum") 

需要在路径中设置 C:\Program Files\Common Files\System\ado\

解决方案:
从系统中拷贝msado15.dll,msjro.dll,放入数据库头文件同目录下,修改头文件:

#import "msado15.dll" rename("EOF", "EndOfFile")
#import "MSJRO.DLL" no_namespace rename("ReplicaTypeEnum", "_ReplicaTypeEnum") 

测试正常。

你可能感兴趣的:(ADODB错误解决办法)