BUG: Optimistic Concurrency Error with DYNAMIC Cursors

Last reviewed: April 9, 1997
Article ID: Q158164
The information in this article applies to:
  • Microsoft SQL Server, version 6.5
  • Microsoft Open Database Connectivity, version 2.5
BUG #: 16136 (6.50.201)

SYMPTOMS

When you attempt to call the open Database Connectivity (ODBC) function SQLSetPos() multiple times with the SQL_UPDATE option on a DYNAMIC cursor, you may incorrectly receive the following error message:

   szSqlState = "01S03", *pfNativeError = 16934,
   szErrorMsg = "[Microsoft][ODBC SQL Server Driver][SQL Server]
                Optimistic concurrency check failed, the row was
                modified outside of this cursor"

WORKAROUND

To work around this problem, switch to a keyset cursor on SQL Server 6.5 Service Pack 1 or later. To obtain SQL Server 6.5 Service Pack 1, see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q154549
   TITLE     : INF: How to Obtain SQL Server 6.5 Service Pack 1

STATUS

Microsoft has confirmed this to be a problem in Microsoft SQL Server version 6.5 and Microsoft Open Database Connectivity version 2.5. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Error 16934 does not occur on very small tables (fewer than 100 rows). The error may occur on the second call to SQLSetPos, as in the following example:

   SQLSetStmtOption(hstmt, SQL_CONCURRENCY, SQL_CONCUR_VALUES);
   SQLSetStmtOption(hstmt, SQL_CURSOR_TYPE, SQL_CURSOR_DYNAMIC);
   SQLExecDirect(hstmt, "select command", SQL_NTS);
   SQLExtendedFetch(hstmt, SQL_FETCH_NEXT);
   SQLSetPos(hstmt, SQL_UPDATE, SQL_LOCK_NO_CHANGE);
   SQLExtendedFetch(hstmt, SQL_FETCH_NEXT);
   SQLSetPos(hstmt, SQL_UPDATE, SQL_LOCK_NO_CHANGE);


Additional query words:
Keywords : kbbug6.50 kbinterop kbother kbusage SSrvProg
Version : 6.5 2.5
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 9, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.