Microsoft KB Archive/324900

= FIX: Recordset.Update Causes Error Message: &quot;Cursor operation conflict&quot; to Occur When You Use Server Side Cursors and an INSTEAD OF Trigger =

Article ID: 324900

Article Last Modified on 2/22/2007

-

APPLIES TO


 * Microsoft SQL Server 2000 Service Pack 2

-



This article was previously published under Q324900



SYMPTOMS
When an ActiveX Data Objects (ADO) application that uses server-side cursors (adUseServer) executes a Recordset.Update on a table with an INSTEAD OF trigger, you receive the following error message:

Run-time error -2147217885 (80040e23) 'Cursor operation conflict'

You do not receive the error message when the table has UPDATE, INSERT or DELETE AFTER triggers.



CAUSE
The SQL Server 2000 cursor update behavior for INSTEAD OF triggers is incorrect.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next SQL Server 2000 Service Pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The typical support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

  Date        Time      Version        Size              File name ---

12/03/2001 12:14 AM                      1,652 bytes  EULA.txt 07/02/2002 11:59 AM                      5,826 bytes  Readme.txt 07/01/2002  4:07 PM                     10,794 bytes  sp2_qfe_serv_uni.sql 07/01/2002  5:50 PM                 12,624,896 bytes  Sqlservr.pdb 07/01/2002  5:50 PM  2000.80.652.0  12,624,896 bytes  Sqlservr.exe



WORKAROUND
To work around this behavior you can either:  Use ADO client-side cursors (adUseClient). -or-

  Perform the update by using an ADODB.Command object with an UPDATE SQL statement. For example: cmd.CommandText = &quot;UPDATE MyTestTable set namefield='asdasdf' where [id] = 1&quot; cmd.Execute 



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



Steps to Reproduce the Behavior
  Use Query Analyzer to open a connection to the SQL Server 2000 pubs database, and then run the following Transact-SQL statement: USE Pubs GO Create Table TestTable ([ID] int NOT NULL, [NameField] varchar(50) NULL, RowGUID uniqueidentifier Default(NewID)) GO Insert Into TestTable ([ID], [NameField]) Values (1, 'test1') GO Insert Into TestTable ([ID], [NameField]) Values (2, 'test2') GO Insert Into TestTable ([ID], [NameField]) Values (3, 'test3') GO Create Trigger t_Test On TestTable Instead Of Update As WAITFOR DELAY '000:00:05' GO </li> Create a Microsoft Visual Basic 6.0 Standard EXE and set a reference to ADO 2.6 (or ADO 2.5 or ADO 2.7).</li>  Put a command button, named Command1, on a form, and then add the following code to the form: Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim strSQL As String

Private Sub Command1_Click

conn.Open &quot;Provider=SQLOLEDB;User ID=MyID;Initial Catalog=pubs;Data Source=MyServer;Password=MyPassword&quot; rs.ActiveConnection = conn rs.CursorLocation = adUseServer rs.CursorType = adOpenStatic rs.LockType = adLockOptimistic strSQL = &quot;Select * From TestTable Where [ID] = 1&quot; rs.Open strSQL rs(&quot;NameField&quot;) = &quot;incorrectValue&quot;

rs.Update  ' Error 'Cursor operation conflict' occurs here.

rs.Close conn.Close End Sub The error message shown in the &quot;Symptoms&quot; section occurs when rs.Update executes. </li></ol>

Keywords: kbhotfixserver kbqfe kbbug kbfix kbqfe KB324900

-

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

© Microsoft Corporation. All rights reserved.