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.

BUG: Problem Updating ADO Hierarchical Recordset When Join Tables Share Same Column Name


View products that this article applies to.

This article was previously published under Q246905

↑ Back to the top


Symptoms

When updating an ActiveX Data Objects (ADO) recordset, an error occurs if the recordset, based on a SHAPE command, joins two tables where the primary key of one table has the same name as a column name of the other table. The following error appears:
Run-time error '-2147467259 (80004005)':

Insufficient key column information for updating or refreshing.
The preceding error occurs when you connect to Oracle through Microsoft ODBC for Oracle.

↑ Back to the top


Status

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

↑ Back to the top


More information

Steps to Reproduce Behavior

  1. Start a new project in Visual Basic and choose Standard EXE. Form1 is created by default.
  2. In the Visual Basic project, add a reference to the the Microsoft ActiveX Data Objects Library.
  3. Double-click Form1. Copy and paste the following code into the Form_Load() event:
        Dim Sql As String
        Dim cn As New ADODB.Connection
        Dim rs As New ADODB.Recordset
        
        cn.Open "Provider=MSDataShape.1;Data Provider=MSDASQL;Driver={Microsoft ODBC for Oracle};UID=xxx;PWD=xxx;Server=MyServer;"
      
        On Error Resume Next
        cn.Execute "Drop Table A"
        cn.Execute "Drop Table B"
        On Error GoTo 0
        cn.Execute "Create Table A (APkID Number PRIMARY KEY, BPkID Number)"
        cn.Execute "Create Table B (BPkID Number PRIMARY KEY, BColumn Varchar2(5))"
        cn.Execute "Insert Into A (APkID) Values(1)"
        cn.Execute "Insert Into B (BPkID, BColumn) Values(1,'Mary')"
        
        Sql = "Shape {Select A.APkID, B.BPkID, B.BColumn From A,B Where A.APkID = B.bPkID}" & _
              " Append Calc(1) as Chapter"
        rs.Open Sql, cn, adOpenKeyset, adLockBatchOptimistic
        rs.Fields("BColumn").Value = "Test"
        rs.UpdateBatch  'Error occurs here
        rs.Close
        cn.Close
    					

↑ Back to the top


Keywords: KB246905, kbpending, kbbug

↑ Back to the top

Article Info
Article ID : 246905
Revision : 3
Created on : 5/8/2003
Published on : 5/8/2003
Exists online : False
Views : 333