在正规DLL内连接数据库,先不说是否创建了什么连接对象什么,我的问题是:
在InitInstance()中初始化了COM库,在Stdafx.h中也加了
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
但为什么有这样的错误:
g:\临时的项目\process\debug\msado15.tlh(169) : error C2011: 'LockTypeEnum' : 'enum' type redefinition
g:\临时的项目\process\debug\msado15.tlh(212) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
g:\临时的项目\process\debug\msado15.tlh(256) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
g:\临时的项目\process\debug\msado15.tlh(277) : error C2011: 'EditModeEnum' : 'enum' type redefinition
g:\临时的项目\process\debug\msado15.tlh(285) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
g:\临时的项目\process\debug\msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
g:\临时的项目\process\debug\msado15.tlh(527) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
Error executing cl.exe.Process.dll - 6 error(s), 1 warning(s)
warning ,就不管它了
帮帮忙
^_^

解决方案 »

  1.   

    在默认情况下,创建DLL工程后,在stdafx.h都会包括下述语句:#ifndef _AFX_NO_DB_SUPPORT
    #include <afxdb.h> // MFC ODBC database classes
    #endif // _AFX_NO_DB_SUPPORT#ifndef _AFX_NO_DAO_SUPPORT
    #include <afxdao.h> // MFC DAO database classes
    #endif // _AFX_NO_DAO_SUPPORT里面已经引入了ADO库,然后你又引入一次.所以就有了
    type redefinition的错误,
    你可以根据需要注释掉上述语句,或者自己不再引入ADO库
      

  2.   

    楼上:
    不可以的,ADO,就是应该加入
    #import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
    也照你说的,注释掉了,还是不行,如果去掉上面的,错误就更多了,我不知道了
      

  3.   

    To byf2002
    you are right
    thank you very much
    passed the 
    #ifndef _AFX_NO_DAO_SUPPORT
    #include <afxdao.h> // MFC DAO database classes
    #endif // _AFX_NO_DAO_SUPPORT