FIX: Hierarchical Child Recordset and ADO Data Control
ID: Q192805
|
The information in this article applies to:
-
Microsoft Visual Basic Professional and Enterprise Editions for Windows, version 6.0
-
ActiveX Data Objects (ADO), versions 2.0, 2.1, 2.1 SP2
SYMPTOMS
Creating a Hierarchical recordset and trying to assign the child recordset
to the "ado data control" results in an error:
"Method 'Recordset' of object 'IAdodc' failed".
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article.
This bug was corrected in Visual Studio 6.0 Service Pack 3.
For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:
Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why
Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed
MORE INFORMATION
Steps to Reproduce Behavior
- Create a new Visual Basic Standard EXE project. Form1 is created by
default.
- Add a reference to "Microsoft ActiveX Data Objects Library." Also,
under Project/Components, add "Microsoft ADO Data Control 6.0 (OLEDB)."
- Add a CommandButton and ADO data control to Form1.
- Make sure you have a DSN for the Northwind database called "nwind."
- Paste the following code in the General Declarations section:
Dim Conn As ADODB.Connection
Dim MainRS As ADODB.Recordset
Private Sub Command1_Click()
Dim XRs as ADODB.Recordset
Set Conn = New ADODB.Connection
Conn.ConnectionString = "Provider=MSDataShape.1;Persist Security
Info=False;Data Source=nwind;Data Provider=MSDASQL"
Conn.Open
Set MainRS = New ADODB.Recordset
MainRS.CursorLocation = adUseClient
Call MainRS.Open(" SHAPE {SELECT * FROM `Customers` WHERE
CustomerID = 'ALFKI'} AS Customer APPEND ({SELECT * FROM
`Orders`} AS OrderChapter RELATE 'CustomerID' TO 'CustomerID') AS
CustomerOrders", Conn, adOpenStatic, adLockBatchOptimistic)
Set XRs = MainRs.Fields("CustomerOrders").Value
Set adodc1.recordset = XRs
End Sub
- Click on the CommandButton and note that the error above is returned.
Additional query words:
Keywords : kberrmsg kbADO200bug kbADO201fix kbDatabase kbVBp kbVBp600bug kbVS600sp3fix kbGrpVBDB kbGrpMDAC kbDSupport kbADO210sp2 kbMDAC210SP2
Version : WINDOWS:2.0,2.1,2.1 SP2,6.0
Platform : WINDOWS
Issue type : kbbug