This article was previously published under Q264701
This article has been archived. It is offered "as is" and will no longer be updated.
If you pass an ADO recordset by using a ByRef method parameter to an out-of-process COM object and the out-of-process COM object generates an error, this error information may not be properly reported to the client application.
When an ADO recordset is marshalled out-of-process using a ByRef method parameter, custom marshalling code implemented by ADO on both the client and server sides is activated, and this code resets the pending OLE error object that is generated by the COM object.
This problem is fixed in the latest service packs for Windows 2000 and MDAC 2.5.
To resolve this problem, obtain the latest service pack for Windows 2000. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
260910 How to Obtain the Latest Windows 2000 Service Pack
To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.5. For additional information, click the following article number to view the article in theMicrosoft Knowledge Base:
293312 INFO: How to Obtain the Latest MDAC 2.5 Service Pack
Date Time Version Size File name Platform --------------------------------------------------------------- 06/09/2000 13:02 2.50.5408.0 327,952 Msadce.dll x86 06/09/2000 12:46 2.50.5408.0 487,696 Msado15.dll x86
One workaround is to pass in an ADO recordset using a ByVal parameter and then return an ADO recordset using an return value.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Data Access Components 2.5 Service Pack 2 and Microsoft Windows 2000 Service Pack 2.
A ByRef parameter is a COM method parameter defined by the COM object's type library as an [in,out] parameter. In Microsoft Visual Basic (VB), if you create a COM object and add the ByRef keyword before some method parameter, Visual Basic will set up this method to both accept and return an object variable by using the [in,out] directive in the COM object's type library.
This problem has been reproduced under the following scenarios:
A Visual Basic or Visual C++ COM EXE server that both accepts an ADO recordset using ByRef [in,out] and inside the method call raises an error.
A Visual Basic or Visual C++ COM DLL hosted in MTS or COM+ that both accepts an ADO recordset ByRef [in,out] and inside the method call raises an error.
In these situations, the actual error raised by the COM component is not reported to the client; instead, the error "Method '~' of object '~' failed" is reported.
Note that you will need to apply this fix to both the client and server machines in order to resolve the issue in cases where client and COM server are on two independent computers (for example, when using DCOM to a remote COM server).