Microsoft KB Archive/246728

= FIX: E_FAIL Error When Referencing Child Recordset in Manually Created Chaptered Recordsets =

Article ID: 246728

Article Last Modified on 5/17/2007

-

APPLIES TO


 * Microsoft Data Access Components 2.1 Service Pack 2

-



This article was previously published under Q246728



SYMPTOMS
When using a manually created chaptered (hierarchical) recordset where no Data Provider is needed, attempts to assign a reference on a child recordset to a Recordset object variable returns an E_FAIL error.

The problem does not occur in either MDAC 2.1 SP1 (version 02.10.3711) or if the chaptered recordset was created by selecting records from a backend database.



CAUSE
In this circumstance, because no Data Provider is needed to create the recordset, the member variable that keeps a reference to the Data Provider's session is being set to NULL.

Later, attempts are made to use this session member variable to create a command object without first checking to see if it is NULL, which generates an error.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Microsoft Data Access Components service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix should have the following file attributes or later:

  Date      Time    Version      Size    File name     Platform -  11/3/99           2.12.4703.0  299KB   Msadce.dll

Workaround
There is no workaround for this problem. If a Data Provider is specified in an attempt to circumvent the problem, the shape provider attempts to connect to the database server when creating the recordset. Lacking any connection information, the connection attempt fails.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This problem was corrected in Microsoft Data Access Components version 2.5.

You can download the latest version of Microsoft Data Access Components from the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/data/aa937695.aspx



Manual Installation

 * 1) Close or stop any applications or services that are using Msadce.dll. This may include Internet Information Server (IIS), Microsoft Transaction Server (MTS), and any ADO, or OLE DB applications.
 * 2) Download the hotfix version of Msadce.dll into a temporary directory.
 * 3) Locate and rename the current version of Msadce.dll, which is in the \Program Files\Common Files\System\MSADC folder.
 * 4) Copy the hotfix version of Msadce.dll into the same location, and then restart your services and applications.

Steps to Reproduce Behavior
Copy the following code into a Visual Basic application, and add a reference to the Microsoft ActiveX Data Objects 2.1 Library. Run the code, and notice that an E_FAIL error occurs when attempting to save the reference to the child recordset into another Recordset object. Dim strSQL As String Dim objRs As ADODB.Recordset Dim objRsChild As ADODB.Recordset Dim objConn As ADODB.Connection Dim objField As ADODB.Field

strSQL = "SHAPE APPEND new adInteger as ParentID, ((SHAPE APPEND  new adInteger " & _ "as ChildID, new adVarChar(40) as Name) RELATE ParentID TO ChildID) AS Columns"

Set objConn = New ADODB.Connection Set objRs = New ADODB.Recordset

objConn.Open "provider=MSDataShape;Data provider=NONE;"

objRs.CursorLocation = adUseClient

objRs.Open strSQL, objConn, adOpenStatic, adLockOptimistic

objRs.AddNew Array("ParentID"), Array(1)

Set objField = objRs.Fields.Item("Columns")

Set objRsChild = objField.Value ' <-- Failure occurs here

Additional query words: datashape data shape provider e_fail error manually created creatable recordset reference child heirarchial chaptered

Keywords: kbhotfixserver kbqfe kbbug kbdatabase kbfix kbmdac250fix kbmdacnosweep kbqfe KB246728

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.