Microsoft KB Archive/257658

= BUG: BatchCollisionCount is Incorrect After You Perform a BatchUpdate to SQL Server 7.0 Database =

Article ID: 257658

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft SQL Server 7.0 Standard Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q257658



SYMPTOMS
After you perform a BatchUpdate from an rdoResultSet object to a Microsoft SQL Server 7.0 database, the BatchCollisionCount property is set incorrectly.



RESOLUTION
To work around this problem you can use Microsoft ActiveX Data Objects to connect to SQL Server 7.0.



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
 In Microsoft Visual Basic 6.0, create a new Standard EXE project. Form1 is added by default. Remove Form1, and then add a standard code module. From the Project menu, click References. In the References dialog box, select Microsoft Remote Data Object 2.0.  Paste the code that follows into the code window for the module.

NOTE: Make sure that you modify the Connect property to connect to your SQL Server 7.0 server: Public Sub Main Dim cn As New rdoConnection Dim rs As rdoResultset cn.CursorDriver = rdUseClientBatch cn.Connect = "driver={sql server};server=ServerName;" & _ "database=pubs;uid=username;pwd=password;" cn.EstablishConnection Set rs = cn.OpenResultset("SELECT * FROM Authors", rdOpenKeyset, rdConcurBatch) cn.Execute "UPDATE Authors SET au_lname = 'NewLastName'" rs.MoveFirst rs.Edit rs!au_lname = "* RS UPDATE 1 *" rs.Update rs.MoveNext rs.Edit rs!au_lname = "* RS UPDATE 2 *" rs.Update rs.MoveNext rs.Edit rs!au_lname = "* RS UPDATE 3 *" rs.Update rs.BatchUpdate If (rs.BatchCollisionCount = 3) Then Debug.Print "BatchCollisionCount PASSED!! Count = " & _ rs.BatchCollisionCount Else Debug.Print "BatchCollisionCount FAILED!! Count = " & _ rs.BatchCollisionCount End If End Sub  Run the application. From the View menu, click Immediate Window.</li></ol>

RESULTS: In the Immediate (Debug) window, note that the BatchCollisionCount is reported to be zero (0) or one (1). However, the BatchCollisionCount should be 3.

Additional query words: sp4 RDO

Keywords: kbbug kbrdo kbdatabase kbeedition kbpending KB257658

-

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

© Microsoft Corporation. All rights reserved.