FIX: AppendOnly Snapshot Recordset Update() Causes ErrorLast reviewed: September 19, 1997Article ID: Q140598 |
2.00 2.10 2.20
WINDOWS NT
kbprg kbbuglist kbfixlist
The information in this article applies to:
SYMPTOMSOpening a recordset as an append-only snapshot with no cursor library support leads to an internal application error (ICE) when Update() is called to commit an AddNew(). A CDBException is thrown and the following error is displayed in the output window of the debugger (DB tracing enabled): In Visual C++ 2.x using the Microsoft Access 7.0 driver:
Error: failure updating record. Invalid argument value State:S1009,Native:57,Origin:[Microsoft][ODBC Microsoft Access 7.0 Driver]This happens when the cursor library is inhibited from loading by passing FALSE as the last parameter to CDatabase Open() prior to opening the recordset or if the cursor library fails to load for any reason.
CAUSEA snapshot recordset relies on the cursor library for additions or updates to the database. If the cursor library is not loaded, the recordset becomes read-only and does not allow additions or updates. In this case, the recordset member variable m_bUpdatable is correctly set to FALSE, but due to a bug in MFC, if the recordset is opened appendOnly, m_bAppendable is still set to TRUE. AddNew() checks m_bAppendable and continues to process the addition. Eventually, Update() is called. Because the cursor library is not present, Update() calls CRecordset::ExecuteSetPosUpdate() to use SQLSetPos for performing the update. SQLSetPos fails and generates the error message. If the appendOnly option is not specified for the snapshot, then both m_bUpdatable and m_bAppendable are set properly and the expected behavior occurs:
RESOLUTIONSnapshots become read-only if the cursor library is not loaded. To get an updatable and appendable snapshot, make sure the cursor library is properly loaded by the application.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual C++ version 4.0.
|
Additional reference words: 2.00 3.00 2.10 3.10 2.20 3.20
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |