Search code examples
vb6odbcwindows-server-2003

ADODB.Connection in VB6 - Open Method fails with Runtime Error '2147221164 (80040154)'


This is something that start to happen on a project on which I am working, and so far I was not able to figure out the root cause.

This stopped working without any change from my side, the only thing I know has changed since the last time I worked on that project is that a disk failed (used to be the E: drive on which some applications were installed). Operative System is Windows Server 2003.

Below the error:

Runtime Error

The Libraries I am adding to the project are the following:

  • Visual Basic For Applications
  • Visual Basic runtime objects and procedures
  • Visual Basic objects and procedures
  • OLE Automation
  • Microsoft CDO for Windows 2000 Library
  • Microsoft Scripting Runtime
  • Windows Scripting Host Object Model
  • Microsoft Data Binding Collection VB6 (SP4)
  • Microsoft ActiveX Data Objecrs 2.8 Library

The object oConn is declared and instantiated the following way:

  1. Dim oConn AS ADODB.Connection
  2. Set oConn = New ADODB.Connection

No reference is marked as MISSING in the VB Project.

I also tried the late binding, but without success. I tried to use regsrv32.exe to reregister msado15.dll, but no joy.

I am really out of idea here, I think that some dependencies are no longer satisfied due to the failure of the disk, but I don't know how to investigate this given the few details provided by the IDE.

Thanks


Solution

  • This question has no easy answer. What I found, and has been also suggested in the comment by @Jim Hewitt, is that MDAC on Windows Server 2003 was corrupted. The component checker is not actually able to identify the version of MDAC, which is an embedded component in that version of Windows. So, summarizing, the whole windows installation is corrupted (no idea on how this could have happened) and Visual Basic 6 doesn't work properly. The solution has been to setup another machine.