Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: Passing ADO Recordset ByRef Resets Error Information


View products that this article applies to.

Symptoms

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.

↑ Back to the top


Cause

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.

↑ Back to the top


Resolution

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 the Microsoft 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 the Microsoft 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 
				

↑ Back to the top


Workaround

One workaround is to pass in an ADO recordset using a ByVal parameter and then return an ADO recordset using an return value.

↑ Back to the top


Status

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.

↑ Back to the top


More information

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:
  1. 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.
  2. 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).

↑ Back to the top


Keywords: KB264701, kbmdac250sp2fix, kbfix, kbbug, kbhotfixserver, kbqfe

↑ Back to the top

Article Info
Article ID : 264701
Revision : 3
Created on : 4/7/2006
Published on : 4/7/2006
Exists online : False
Views : 279