BUG: Problem Updating ADO Hierarchical Recordset When Join Tables Share Same Column Name
ID: Q246905
|
The information in this article applies to:
-
Microsoft Data Access Components versions 2.1, 2.1 (GA), 2.1 SP1, 2.1 SP2, 2.5
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 also occurs when connecting to Oracle through Microsoft ODBC for Oracle.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
MORE INFORMATION
Steps to Reproduce Behavior
- Start a new project in Visual Basic and choose Standard EXE. Form1 is created by default.
- In the Visual Basic project, add a reference to the the Microsoft ActiveX Data Objects 2.5 Library.
- 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
Additional query words:
kbDSupport kbGrpVBDB kbGrpMDAC kbMDAC250
Keywords : kbADO kbGrpVBDB kbGrpMDAC kbDSupport kbMDAC250
Version : WINDOWS:2.1,2.1 (GA),2.1 SP1,2.1 SP2,2.5
Platform : WINDOWS
Issue type : kbbug