FIX: "No rows were affected by the update or delete operation"

Last reviewed: September 18, 1997
Article ID: Q120512
1.50 WINDOWS kbprg kbfixlist kbbuglist

The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), included with: Microsoft Visual C++ for Windows, version 1.5

SYMPTOMS

When you use snapshots with the Microsoft Foundation Class Library database classes, the following error message occurs:

   Warning: ODBC Success With Info, Warning: 0 rows affected by
      update operation (expected 1).
   No rows were affected by the update or delete operation.

CAUSE

This message may occur because of a bug in the ODBC cursor library (ODBCCURS.DLL). The cursor library incorrectly handles modifying of fields which have a pre-defined length (such as numeric fields or any field that is not a text field and not a variable length field) in the following scenarios:

  • A field with a pre-defined length is null in a table and an application changes the field to a non-null value. After the field has been updated to the non-null value, any subsequent updates fail.
  • A field with a pre-defined length is non-null in a table and an application changes the field to a null value. After the field has been updated to a null value, any subsequent updates will fail.

The cursor library incorrectly updates the snapshot values in these cases. The bug won't occur if the snapshot is refreshed between updates by doing a requery.

RESOLUTION

To work around the problem, use one of these techniques:

  • Requery after each update. In other words, set the field to null, and requery. Set the field to non-null, and requery, and so on.
  • Use text fields for situations where the data may be changing from null to non-null data and visa versa.

STATUS

Microsoft has confirmed this to be a bug in the ODBC cursor library which is provided with Visual C++ version 1.5. The bug has been fixed with the cursor library (ODBCCURS.DLL) included in Visual C++ version 1.51. The version stamp on the ODBCCURS.DLL with Visual C++ version 1.51 is 2.00.2011. Look at the properties for the file with the File Manager to get the version stamp.

REFERENCES

For more information about the cursor library, see the on-line books in Visual C++ version 1.5 or see Appendix G of the ODBC 2.0 Programmer's Reference (ISBN: 1-55615-658-8).


Additional reference words: 1.50 2.50
KBCategory: kbprg kbfixlist kbbuglist
KBSubcategory: MfcDatabase
Keywords : kb16bitonly MfcDatabase kbbuglist kbfixlist kbprg
Technology : kbMfc
Version : 1.50
Platform : WINDOWS
Solution Type : kbfix


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: September 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.