FIX: Floating Point Field Incorrectly Assigned -9.123E+191.51 1.52 WINDOWS kbprg kbbuglist kbfixlistThe information in this article applies to:
SYMPTOMSWhen you use the RFX_Single() function and set a field to null, the field may actually be set to -9.123E+19 rather than null. For example, the following code doesn't set the field to null as expected.
CAUSEThe problem is caused by a bug in the MFC database classes. Specifically, the RFX_Single() function performs an incorrect check to see if a field is null. Looking at DBFLT.CPP in the MSVC15\MFC\SRC directory, you'll see this:
The code doesn't work correctly because AFX_RFX_SINGLE_PSEUDO_NULL is
defined in AFXDB.H as this:
It should be defined as this:
As you can see the code compares a float to a double, so the comparison
will never be true.
RESOLUTIONTo work around this problem, follow these steps: 1. Copy the RFX_Single() function from DBFLT.CPP into the CRecordset's 2. Include the following code before the RFX_Single2() function:
3. Change the call to RFX_Single() in the CRecordset's DoFieldExchange()
NOTE: the problem does not occur when using RFX_Double, so if you can use a
double field type in your database, use RFX_Double to avoid the problem.
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 reference words: 1.51 1.52 2.51 2.52 ODBC numeric number KBCategory: kbprg kbbuglist kbfixlist KBSubcategory: MfcDatabase
|
Last Reviewed: December 21, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |