ADO编程:error C2011: 'LockTypeEnum' : 'enum' type redefinition
C++ Code
1
2 3 |
// Import the ADO type library
#import "C:\\Program Files\\Common Files\\system\\ado\\msadox.dll" #import "C:\\Program Files\\Common Files\\System\\ado\\msado15.dll" no_namespace rename ("EOF","adoEOF") |
以下网上流传的方法,被转来转去,然而试了没啥作用!
C++ Code
1
2 3 4 5 6 7 8 9 10 11 12 13 |
// 1)
#pragma warning(disable:4146) #import "C:/Program Files/Common Files/System/ADO/msado15.dll" named_guids rename("EOF","adoEOF"), rename("BOF","adoBOF") #pragma warning(default:4146) using namespace ADODB; // 2) #pragma warning(disable:4146) #import "C:/Program Files/Common Files/System/ado/msado15.dll" / no_namespace / rename("EOF","adoEOF") rename("DataTypeEnum","adoDataTypeEnum") / rename("FieldAttributeEnum", "adoFielAttributeEnum") rename("EditModeEnum", "adoEditModeEnum") / rename("LockTypeEnum", "adoLockTypeEnum") rename("RecordStatusEnum", "adoRecordStatusEnum") / rename("ParameterDirectionEnum", "adoParameterDirectionEnum") |
最终有效的方法:(VC++6.0)Project ->Setting -> C/C++ ->perprocessor ->perprocessor definitions : 里面添加 宏 _AFX_NO_DAO_SUPPORT
希望大家能把自己的所学和他人一起分享,不要去鄙视别人索取时的贪婪,因为最应该被鄙视的是不肯分享时的吝啬。