FIX: SQLPrepare() Returns Incorrect Error on FOR UPDATELast reviewed: May 1, 1997Article ID: Q135839 |
The information in this article applies to:
SYMPTOMSWhen you use the ODBC SQL Server driver in conjunction with Microsoft SQL Server version 6.0 server-side cursors to attempt the creation of an updateable rowset via SQLPrepare(), the FOR UPDATE portion of the SELECT statement returns an incorrect error message.
WORKAROUNDIf you do not need to use SQLPrepare() to create your updateable rowset, then you should use SQLExecDirect() to achieve this functionality. Otherwise, the same functionality can be accomplished by excluding the FOR UPDATE portion of the SELECT statement from the string passed to SQLPrepare(). When this query has been prepared, the rowset may still be operated on with modification operations using SQLExtendedFetch() and SQLSetPos().
STATUSMicrosoft has confirmed this to be a problem in the ODBC SQL Server Driver version 2.50.0121. This problem has been corrected in the ODBC SQL Server Driver version 2.65.0201. For more information, contact your primary support provider.
MORE INFORMATIONFor example, with the SQLSetStmtOption() settings made to invoke server side cursor usage (as defined in SQL Books Online under the ODBC SQL Server Driver section headings "Using ODBC Cursors" and "Creating Cursors") the statement:
Select * from <table_name> for updatereturns the following incorrect error message:
Return Code = SQL_ERROR = -1 szSqlState = "37000" *pfNativeError = 1003 *pcbErrorMsg = 105 szErrorMsg="[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR." |
Additional query words: sql6
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |