vc 连接数据库CreateInstance失败问题

来源:互联网 发布:网络诈骗1000元立案吗 编辑:程序博客网 时间:2024/05/23 20:02
下面是在微软MSDN官网查到的类似问题的答疑,具体网址如下
http://social.msdn.microsoft.com/Forums/vstudio/en-US/701d05aa-e8d2-4f46-8cc1-448a8d35bd37/windows-7-sp1-ado-compatibility
内容:
Windows 7 SP1 ADO Compatibility  
Visual Studio Languages forums  >  Visual C++
Question


0
Sign in to vote
Hi:
I am a little confused, the same code compiled on different platforms(Windows 7,Windows 7 SP1 ,Windows XP SP3) have different results with VC2010 professional
 _ConnectionPtr m_pConn;
m_pConn.CreateInstance(__uuidof(Connection));
compiled  on Windows 7 or  Windows XP SP3 , normal work.But complied on Windows 7 SP1,only run Windows 7 SP1,doesn't work on other computers without Win7 SP1,  after m_pConn.CreateInstance(__uuidof(Connection)),result :m_pConn == NULL!


Monday, February 28, 2011 6:32 AM
Reply | Quote |

default20110 Points
Answers


0
Sign in to vote
Hi:

This is Windows 7 32bit! Install SP1 ,msado15.dll version:6.1.7601.17514. old version :6.1.7600.16385 of without SP1!

KB983264 contain : Msado15.dll 6.1.7600.20701 !

SO, If ADO program compiled on Windows 7 SP1 ,your ADO program can work on a computer with KB983246 or install Windows 7 SP1!

OK,Thanks !

 

Wednesday, March 02, 2011 3:11 AM
Reply | Quote |

default20110 Points
All replies


0
Sign in to vote
Explain what "doesn't work" means.

m_pConn.CreateInstance() returns an HRESULT if it fails. What is its value?

Monday, February 28, 2011 4:57 PM
Reply | Quote |

Brian Muth (MCC, MVP) 49,380 Points
 

0
Sign in to vote
Hi:

Becuse I compiled  on Windows 7 SP1,application only work the computer with Windows 7 SP1!or else m_pConn.CreateInstance() failed! HRESULT value: -2147467262

 

Tuesday, March 01, 2011 1:32 AM
Reply | Quote |

default20110 Points
 

0
Sign in to vote
i think first of all you check whether your windows 7 is 64 bit or 32 bit. if it is 64 bit and you have 64 bit driver used for database access i.e(check paths from program files or Program files(x86) it should be program files(x86) for 32 bit application  on windows 7 64 bit).  it is also worth checking whether you have proper version of drivers for ADO for 32 bit if your application is 32 bit and 64 bit if your application is 64 bit. By default Windows7 only install one of them depend on windows version at a time.

 

Fahd Anwar
Tuesday, March 01, 2011 10:54 AM
Reply | Quote |

Fahd Anwar فہد انورElixir Technologies Paki...315 Points
 

0
Sign in to vote
Hi:

Becuse I compiled  on Windows 7 SP1,application only work the computer with Windows 7 SP1!or else m_pConn.CreateInstance() failed! HRESULT value: -2147467262

 


That value is 0x80004002, which is "No such interface is supported". There is something odd here. I'm wondering if you are using the #import directive on a version of ADO which is not available on earlier versions of the operating system.
Tuesday, March 01, 2011 5:04 PM

Reply | Quote |

Brian Muth (MCC, MVP) 49,380 Points
 

0
Sign in to vote
Hi:

This is Windows 7 32bit! Install SP1 ,msado15.dll version:6.1.7601.17514. old version :6.1.7600.16385 of without SP1!

KB983264 contain : Msado15.dll 6.1.7600.20701 !

SO, If ADO program compiled on Windows 7 SP1 ,your ADO program can work on a computer with KB983246 or install Windows 7 SP1!

希望能给碰到类似问题的有点作用!
0 0
原创粉丝点击