开发者

If I compile a VB6 app on win7, ADODB.Connection errors with "Class does not support Automation or does not support expected interface"

If I compile a VB6 app on win7, ADODB.Connection errors with "Class does not support Automation or does not support expected interface"

I compiled some VB6 code on my Win7 x64 machine and the result .exe will not run correctly on any other machine.

VB6 code is just a new template .exe file with one button, a reference to "Microsoft ActiveX Data Objects 2.6 Library" and the following code in the button press event:

Dim db
Set db = New ADODB.Connection

It runs correctly on my machine, but no others (even other Win7 x64 machines) (Update: I found TWO other users where it runs and one of them is Jeff Atwood!, but most machines have the same problem)

I checked the references screen on both machines to see if a reference failed (it wouldn't compile then though and it compiles fine). Everything looks legit. On the 64 bit machines, the references go into SysWow64 instead of system32.

I've even compiled this successfully on a Vista 64 bit machine and had it run correctly. It's only the compile on the Windows 7 and then running on any other machine where the error happens.

Here are the开发者_运维知识库 results of running CompChecker on my box:

If I compile a VB6 app on win7, ADODB.Connection errors with "Class does not support Automation or does not support expected interface"

Registry info: ADODB.Connection has GUID HKEY_CLASSES_ROOT\CLSID{00000514-0000-0010-8000-00AA006D2EA4}

InprocServer32 is %CommonProgramFiles%\System\ado\msado15.dll


This is a Windows 7 SP1 issue. See http://support.microsoft.com/kb/2517589 for workarounds.

There are other ways around this:

  1. Use ADO 2.8 instead (from Win 7 RTM disk)
  2. Use late-binding (probably the easiest)
  3. There are a million things that people are trying on this very long and angry thread: Breaking change in MDAC ADODB COM components in Windows 7 Service Pack 1

Also, another thing, msado15.dll is not supported on x64 Win 7 as listed here: http://support.microsoft.com/kb/983246. It's a big page, just search on msado15.dll.


Check out the version of the MDAC components in both machines using this tool

Also be sure that you are using the same SQL Server (guessing) version database, since I've noticed that SQL Server 2008 x64 works differents than previous versions handling connections (when using VB6)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜