在stdafx.h中加入
#import "d:\program files\common files\system\ado\msado15.dll" \
no_namespace \
rename ("EOF", "adoEOF")   编译时出错d:\ys\release\msado15.tlh(171) : error C2011: 'LockTypeEnum' : 'enum' type redefinition
d:\ys\release\msado15.tlh(214) : error C2011: 'DataTypeEnum' : 'enum' type redefinition
d:\ys\release\msado15.tlh(258) : error C2011: 'FieldAttributeEnum' : 'enum' type redefinition
d:\ys\release\msado15.tlh(279) : error C2011: 'EditModeEnum' : 'enum' type redefinition
d:\ys\release\msado15.tlh(287) : error C2011: 'RecordStatusEnum' : 'enum' type redefinition
d:\ys\release\msado15.tlh(407) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
d:\ys\release\msado15.tlh(530) : error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
Error executing cl.exe.

解决方案 »

  1.   

    语句没有错!!!!!
    在stdafx.h  又定义了
    #include "afxdao.h"   这会不会有影响
      

  2.   

    我知道了是同时定义的问题(试过会出现这个问题),有没有办法解决#include "afxdao.h"
    // 加入ADO支持库, jingzhou xu
    #import "c:\program files\common files\system\ado\msado15.dll" \
    no_namespace \
    rename ("EOF", "adoEOF")
      

  3.   

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;169496
    http://blog.csdn.net/jiangsheng/archive/2004/03/15/3799.aspx
      

  4.   

    ADO与下面的afxdao.h中的定义冲突
    #include "afxdao.h"
    要么去掉上面这句不使用dao,要么不使用no_namespace,访问时带上命名空间进行访问
      

  5.   

    这样的话可以用 ADO::_ConnectionPtr 这样的形式来访问