FIX: RFX_Binary Updates Unchanged CByteArray Data

Last reviewed: September 19, 1997
Article ID: Q160073
The information in this article applies to:
  • The Microsoft Foundation Classes (MFC) included with: - Microsoft Visual C++, 32-bit Edition, version 4.2

SYMPTOMS

The MFC ODBC classes attempt to update the CByteArray data for a record each time you move off that record, even if the data was not changed.

If you have a field that cannot be updated, you may receive an error when the update fails. For example, if your recordset contains a SQL Server TIMESTAMP column, you may see the following error:

   Can't update a TIMESTAMP column.

CAUSE

The RFX_Binary() function is incorrectly casting the BYTE* data member of the CByteArray to a CByteArray*. Because of this, the CByteArray data always appears to have been changed since the last update.

RESOLUTION

In the DoFieldExchange() of your recordset class, replace calls to RFX_Binary() with calls to the with RFX_Binary_Fix() function.

The following file is available for download from the Microsoft Software Library:

 ~ Rfxbinfx.exe (size: 16883 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Visual C++ version 5.0.

MORE INFORMATION

The RFX_Binary() function is called from within the CRecordset DoFieldExchange() function to handle CByteArray data.

Once you have downloaded Rfxbinfx.exe and run the .exe to extract the RFX_Binary_Fix source code, include RFXBINFX.H in your recordset CPP file.

In your implementation of the DoFieldExchange() function, change each call to RFX_Binary to a call to the RFX_Binary_Fix function.


Additional query words: IsFieldDirty SetFieldDirty BLOB

Keywords : MfcDatabase vcbuglist420 vcfixlist500 kbfile kbprg kbbuglist kbfixlist
Technology : kbMfc
Version : 4.2
Platform : NT WINDOWS
Issue type : kbbug
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 19, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.