读书人

关于使用ADO连接数据库的一个奇怪有关

发布时间: 2012-01-21 21:31:43 作者: rapoo

关于使用ADO连接数据库的一个奇怪问题
使用ADO连接数据库
在普通情况下,写一个exe工程
然后在stdafx.h里面
#import "c:\program files\common files\system\ado\msado15.dll " no_namespace rename( "EOF ", "adoEOF ")
然后进行各项操作,一切正常。

现在我做一个项目,里面有一个模块用到数据库。
于是我写一个dll,在里面的stdafx.h中
#import "c:\program files\common files\system\ado\msado15.dll " no_namespace rename( "EOF ", "adoEOF ")
然后编译,编译器提示:

--------------------Configuration: DBDll - Win32 Debug--------------------
Compiling...
TestClass.cpp
e:\mydb\dbdll\debug\msado15.tlh(171) : error C2011: 'LockTypeEnum ' : 'enum ' type redefinition
e:\mydb\dbdll\debug\msado15.tlh(214) : error C2011: 'DataTypeEnum ' : 'enum ' type redefinition
e:\mydb\dbdll\debug\msado15.tlh(258) : error C2011: 'FieldAttributeEnum ' : 'enum ' type redefinition
e:\mydb\dbdll\debug\msado15.tlh(279) : error C2011: 'EditModeEnum ' : 'enum ' type redefinition
e:\mydb\dbdll\debug\msado15.tlh(287) : error C2011: 'RecordStatusEnum ' : 'enum ' type redefinition
e:\mydb\dbdll\debug\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
e:\mydb\dbdll\debug\msado15.tlh(531) : error C2011: 'ParameterDirectionEnum ' : 'enum ' type redefinition
Error executing cl.exe.

DBDll.dll - 6 error(s), 1 warning(s)

总体来说就是提醒出现重复定义。
不知哪位高人能够解决。感激万分!

[解决办法]
#import "msado15.dll " rename_namespace( "myADO ") rename( "EOF ", "adoEOF ")
using namespace myADO;
[解决办法]
MARK

读书人网 >VC/MFC

热点推荐