ADODB COM object not found

大城市里の小女人 提交于 2019-12-22 12:26:11

问题


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)).,


回答1:


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):

  • An ADO application does not run on down-level operating systems after you recompile it on a computer that is running Windows 7 SP 1 or Windows Server 2008 R2 SP 1 or that has KB983246 installed

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:

  • Breaking change in MDAC ADODB COM components in Windows 7 Service Pack 1

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:

  • An ADO-based application that is compiled in Windows 7 SP1 or in Windows Server 2008 R2 SP1 does not run in earlier versions of Windows



回答2:


Maybe you can try the following utility to identify if it is really there or not: MDAC Utility: Component Checker http://www.microsoft.com/download/en/details.aspx?id=1953 It doesn't mention Windows Server 2008 but maybe it works...

If you are sure there is no ADODB COM object in that server then you need to install the MDAC2.8 components that you can also download from Microsoft.

Link: http://www.microsoft.com/download/en/details.aspx?id=5793

Also, in a Windows Server 2008 you can go to folder: C:\Program Files\Common Files\System\ado and check if you have the MDAC components there. For MDAC 2.8 you should have: msado28.tlb which is the one you can use to reference ADODB objects in a MS OFfice VBA project.



来源:https://stackoverflow.com/questions/6745007/adodb-com-object-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!