mfc常规动态链接库ADO方式访问数据库问题
mfc常规动态链接库里面以Ado方式访问数据库出现问题。我在stdafx.h中已经添加#import"C:\ProgramFiles\CommonFiles\System...
mfc常规动态链接库里面以Ado方式访问数据库出现问题。我在stdafx.h中已经添加#import "C:\Program Files\Common Files\System\ado\msado15.dll" no_namespace rename("EOF","rsEOF")
相关查询代码如下:
CoInitialize(NULL);
_ConnectionPtr pConn(__uuidof(Connection));
_RecordsetPtr pRst(__uuidof(Recordset));
pConn->ConnectionString="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Automation;Data Source=.";
pConn->Open("","","",adConnectUnspecified);
CString strSQL;
strSQL.Format("select * from yaoceData);
pRst=pConn->Execute(_bstr_t(strSQL),NULL,adCmdText);
pRst->Update();
pRst->Close();
pConn->Close();
pRst.Release();
pConn.Release();
CoUninitialize();
编译运行时有如下错误:
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
warning C4146: unary minus operator applied to unsigned type, result still unsigned
error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
请高手解答 展开
相关查询代码如下:
CoInitialize(NULL);
_ConnectionPtr pConn(__uuidof(Connection));
_RecordsetPtr pRst(__uuidof(Recordset));
pConn->ConnectionString="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Automation;Data Source=.";
pConn->Open("","","",adConnectUnspecified);
CString strSQL;
strSQL.Format("select * from yaoceData);
pRst=pConn->Execute(_bstr_t(strSQL),NULL,adCmdText);
pRst->Update();
pRst->Close();
pConn->Close();
pRst.Release();
pConn.Release();
CoUninitialize();
编译运行时有如下错误:
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
warning C4146: unary minus operator applied to unsigned type, result still unsigned
error C2011: 'ParameterDirectionEnum' : 'enum' type redefinition
请高手解答 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询