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: E_FAIL Error When Referencing Child Recordset in Manually Created Chaptered Recordsets


View products that this article applies to.

This article was previously published under Q246728

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


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

↑ Back to the top


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:

↑ Back to the top


More information

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
				

↑ Back to the top


Keywords: KB246728, kbqfe, kbmdacnosweep, kbmdac250fix, kbfix, kbdatabase, kbbug, kbqfe, kbhotfixserver

↑ Back to the top

Article Info
Article ID : 246728
Revision : 8
Created on : 5/17/2007
Published on : 5/17/2007
Exists online : False
Views : 365