Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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:

comp checker results on box

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

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

like image 426
Michael Pryor Avatar asked Apr 28 '11 17:04

Michael Pryor


1 Answers

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.

like image 187
Todd Main Avatar answered Oct 19 '22 01:10

Todd Main