m_pConnection.CreateInstance(__uuidof(Connection))失败
我的做法是这样的:
1、在stdafx.h文件中加入#import "c:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","adoEOF")
2、在InitInstance()
{
//.......
if(!AfxOleInit())
{
AfxMessageBox("init com failed");
return FALSE;
}
//.......
}
3、当执行到hr=m_pConnection.CreateInstance(__uuidof(Connection));
if (FAILED(hr))
{
AfxMessageBox("m_pConnection.CreateInstance() failed");
return FALSE;
}
就会失败。
说明一下情况,数据库是access的,数据库文件是access2003的,程序在我的电脑(win7+access2010中文版),公司的电脑(XP+access2003中文版,XP(英文的)+access2003英文版),都可以运行,在客户的电脑就会出现上面的错误,客户电脑(XP英文版+access2010英文版)。唯一区别就是我没有在access2010英文版的测试过。如果解决不了,在找个英文的access2010试试,不知道有谁知道这是什么情况?