ADODB COM object not found

Tomas picture Tomas · Jul 19, 2011 · Viewed 8.7k times · Source

I am using ADODB COM object in my c# application which is developed on Windows 2008 R2 Standard 64bit. Now I have moved application on prod server with Windows 2008 Standard 64bit(not R2) and now I get error below. It seems MDAC 2.8 is not installed on my prod machine? I can't find any reference how to install MDAC 2.8 on Windows 2008 machine, maybe someone could point me to right direction?

Error: Unable to cast COM object of type 'ADODB.StreamClass' to interface type 'ADODB._Stream'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00001565-0000-0010-8000-00AA006D2EA4}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).,

Answer

Heinzi picture Heinzi · Jul 19, 2011

With Windows Server 2008 R2 SP1, the ADO COM interfaces were changed. As a result, any ADO application compiled on a system with Windows 7 SP1 or Server 2008 R2 SP1 does not run on older operating systems (such as Server 2008 non-R2).

Here's the link to the Knowledge Base article describing this issue (KB2517589):

The article also contains a few workarounds, in particular, it links to a "compatibility typelib" that you can use for compiling on your dev machine.

Unfortunately, there is no "real" solution for this problem yet (which is particularly painful for VBA developers, where the only current workaround is to uninstall Windows 7 SP1 on the dev machine). There is a thread in the Microsoft Forums where this issue is discussed and where updates are posted:


UPDATE: In the meantime, Microsoft has released a fix for this issue. If you install the hotfix from the following page (KB 2640696) on your Windows 7 SP1/2008R2 SP1 development machine and recompile your application, it will work again on older operating systems: