Markus Karg
June 23rd, 1998, 01:35 PM
I just covered a bug of the MFC delivered with VC++5.0. The MFC does not hold a flag for a database field beeing NULL when accessing an ODBC data source by CRecordset, but only sets its value to a constant defined in the MFC source code. This constants value has to be higher than the maximum value ODBC accepts for a field of this type, so what the MFC does is to write an "MAXINT" value into an integer and so on to remember a field to be null. The bug is, that the constant for integer is defined with a wrong value. The MFC does correctly write it into the data field, but neither the MFC nor the database does recognize it as null but as a real value! So the result is, that a buggy value of 32787 is written to the database field instead of NULL.
Microsoft just wrote me, that I'm right an this is truely a bug, but they do not know how or when to fix it (funny, the fix is just to increase the constant...).
A first workaround is to exchange all RfxInteger by RfxLong, so MFC treats integer fields as long fields and uses a bigger constant. The better way would be to patch the MFC source code and exchange the value for integeres.
Microsoft just wrote me, that I'm right an this is truely a bug, but they do not know how or when to fix it (funny, the fix is just to increase the constant...).
A first workaround is to exchange all RfxInteger by RfxLong, so MFC treats integer fields as long fields and uses a bigger constant. The better way would be to patch the MFC source code and exchange the value for integeres.