Microsoft KB Archive/246905

From BetaArchive Wiki
Knowledge Base

Article ID: 246905

Article Last Modified on 5/8/2003


  • Microsoft Data Access Components 2.1
  • Microsoft Data Access Components 2.1 Service Pack 2
  • Microsoft Data Access Components 2.1 Service Pack 1
  • Microsoft Data Access Components 2.1 Service Pack 2
  • Microsoft Data Access Components 2.5
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.7

This article was previously published under Q246905


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.


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


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

Keywords: kbbug kbpending KB246905