1
#import "c:/program files/common files/system/ado/msado15.dll" no_namespace rename("EOF","adoEOF")

但是在编译的时候会报如下错误:
error C2011: ‘’’’LockTypeEnum’’’’ : ‘’’’enum’’’’ type redefinition
error C2011: ‘’’’DataTypeEnum’’’’ : ‘’’’enum’’’’ type redefinition
error C2011: ‘’’’FieldAttributeEnum’’’’ : ‘’’’enum’’’’ type redefinition
error C2011: ‘’’’EditModeEnum’’’’ : ‘’’’enum’’’’ type redefinition
error C2011: ‘’’’RecordStatusEnum’’’’ : ‘’’’enum’’’’ type redefinition

在网上查找最终使用如下方法解决:

在stdafx.h中使用如下字符串.

1
2
3
4
5
6
7
#import "E:\vs2008\BuildNcProgram\BuildNcProgram\dll\msado15.dll" no_namespace \

rename("EOF","adoEOF")rename("BOF","adoBOF") \
rename("DataTypeEnum","adoDataTypeEnum") \
rename("FieldAttributeEnum", "adoFielAttributeEnum") rename("EditModeEnum", "adoEditModeEnum") \
rename("LockTypeEnum", "adoLockTypeEnum") rename("RecordStatusEnum", "adoRecordStatusEnum") \
rename("ParameterDirectionEnum", "adoParameterDirectionEnum") //导入ADO动态连接库