C++ CreateInstance,"ADODB.Connection";创建接口失败的解决方法

数据库对象mssql2005sp3专业版:

一般数据引用该路径文件#import "c:\\program files\\common files\\system\\ado\\msado15.dll" no_namespace rename("EOF", "adoEOF")。但是,我昨天在一台电脑上就是不行,始终报错误:

HRESULT hr = pConnection.CreateInstance("ADODB.Connection");创建接口失败,换成

HRESULT hr = pConnection.CreateInstance(_uuidof(Connection))也不行,反复测试也不行,终于在csdn bbs里面找到一个解决方法,如下:

#import "c:\\program files\\common files\\system\\ado\\msado20.tlb" no_namespace rename("EOF", "adoEOF")。使用这句话就可以了

版权声明:本文为博主原创文章,未经博主允许不得转载。