The information in this article applies to:
SYMPTOMSWhen calling IsFieldDirty() twice, directly or indirectly, the following exception occurs: This simplified example demonstrates how to see the error:
IsFieldDirty() is called twice -- once explicitly and then indirectly in
the Update() call.
CAUSEThe problem lies in the MarkForUpdate() function. Here is the code shown in \MSVC20\MFC\SRC\DBCORE.CPP:
The SeekToBegin() call is made while the CArchive object pointed to by
m_par is still attached to the file. The CArchive doesn't know that the
memfile's file pointer has been moved by the SeekToBegin() call. When the
archive is deleted, its Flush() member function is called. In that
function, the archive attempts to move the file pointer back from where it
thinks the current file position is to the beginning of the file. Because
the current file position is already at the beginning of the file, a bad
seek CFileException is thrown.
RESOLUTION
The solution is to move the SeekToBegin() function to a position following
the delete of the CArchive that is attached to the file.
Again, copy the Update(), UpdateInsertDelete(), and IsFieldDirty()
functions from the code in DBCORE.CPP to functions of the same name in your
new CRecordset-derived class.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Visual C++, 32-bit Edition, version 2.2 Additional query words: 2.00 2.10 3.0 3.1 3.00 3.10
Keywords : kbDatabase kbMFC kbODBC kbVC |
Last Reviewed: January 19, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |