Microsoft KB Archive/293867

= BUG: SQL Server ODBC Driver 3.7 Bug with BatchUpdate and RDO =

Article ID: 293867

Article Last Modified on 10/17/2003

-

APPLIES TO


 * Microsoft SQL Server 7.0 Standard Edition
 * Microsoft Data Access Components 2.5

-



This article was previously published under Q293867



SYMPTOMS
Remote Data Objects (RDO) may return the wrong status after a record is updated. This behavior occurs only with the SQL Server ODBC 3.7 driver. When multiple records are inserted, the first record correctly reports a status of 0, but the remaining records return a status of 2, even though the records were correctly inserted.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Create a data source name (DSN) called BatchTest for SQL Server.  Use the following script to create a table in SQL Server: Create Table tblBatch (       ID integer Primary Key,        Code char (3) NULL,        ISBN char (3) NULL        )  Create a new Standard EXE project in Visual Basic. Form1 is created by default. Set a Project Reference to Microsoft Remote Data Object 2.0.  Paste the following code into the code section of Form1: Option Explicit

Private Sub Form_Load On Local Error GoTo ErrorHandler Dim rdoConn As New rdoConnection Dim rdoRS As rdoResultset Dim sConnect, sSQL As String Dim iResult, iRowCount, iStatus, iCounter As Integer ' ODBC connection string sConnect = &quot;DSN=BatchTest;&quot; With rdoConn .Connect = sConnect .CursorDriver = rdUseClientBatch .EstablishConnection (rdDriverNoPrompt) End With

' The following code creates an Open recordset and then populates it. sSQL = &quot;SELECT * From tblBatch&quot;

Set rdoRS = rdoConn.OpenResultset(sSQL, rdOpenStatic, rdConcurBatch, rdExecDirect) iRowCount = rdoRS.rdoColumns.Count With rdoRS .AddNew .rdoColumns(0) = 4 .rdoColumns(1) = &quot;ALA&quot; .rdoColumns(2) = &quot;A&quot; .Update .AddNew .rdoColumns(0) = 5 .rdoColumns(1) = &quot;ALB&quot; .rdoColumns(2) = &quot;B&quot; .Update

.AddNew .rdoColumns(0) = 6 .rdoColumns(1) = &quot;ALC&quot; .rdoColumns(2) = &quot;C&quot; .Update ' Check status BEFORE. Debug.Print &quot;Added Local - Before BatchUpdate&quot; iRowCount = .RowCount iCounter = 0 .MoveFirst Do While Not .EOF iCounter = iCounter + 1 Debug.Print &quot;Row #&quot; & iCounter & &quot; of &quot; & iRowCount & &quot; is &quot; & .Status .MoveNext Loop .BatchUpdate False, True ' Check status AFTER. Debug.Print &quot;Added Local - After BatchUpdate&quot; iRowCount = .RowCount iCounter = 0 .MoveFirst Do While Not .EOF iCounter = iCounter + 1 Debug.Print &quot;Row #&quot; & iCounter & &quot; of &quot; & iRowCount & &quot; is &quot; & .Status .MoveNext Loop

End With MsgBox &quot;Finished&quot;

rdoConn.Close Exit Sub ErrorHandler: Dim er As rdoError For Each er In rdoErrors Debug.Print &quot;RDO Error -> &quot; & er.Number & &quot;: &quot; & er.Description Next er End Sub  Run the code. The Immediate window reports the following status information:

<pre class="fixed_text">Added Local - Before BatchUpdate Row #1 of 3 is 1 Row #2 of 3 is 1 Row #3 of 3 is 1 Added Local - After BatchUpdate Row #1 of 3 is 0 Row #2 of 3 is 2 Row #3 of 3 is 2

</li></ol>

Keywords: kbbug kbrdo kbdatabase kbpending KB293867

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.