The information in this article applies to:
SYMPTOMSWhile performing the CRecordset::Update( ) function using dynaset cursors on a table containing a numeric or decimal field(s) the following error message appears: This happens when the CString::Format( )operation involving floating point numbers is performed on a CString member variable bound to the decimal or numeric field(s) in the table prior to the update. CAUSEIn Visual C++ version 6.0, the minimum number of characters to represent a float in a CString has been increased from 128 to 312. By default, RFX_Text( ) binds a 256 byte buffer to a text column if a CString::Format( ) is performed on a CRecordset bound member variable as in the following example:
Consequently, the buffer is reallocated. In MFC ODBC, a variable is bound to a field in the table only during CRecordset::Open( ). Once bound, its binding address must remain valid as long as the ODBC binding remains in effect. The reallocation causes this binding address to change and results in the debug assertion.
RESOLUTIONSet the fourth parameter of RFX_Text (nMaxLength) to be greater than or equal to 312. This ensures that the CString buffer allocated for the variable bound to the numeric or decimal field is at least 312 bytes, thereby avoiding the reallocation on a CString::Format( ). STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. REFERENCESQ197448 PRB: CRecordset "String Cannot Be Converted To Number" Error Additional query words:
Keywords : kbdocfix kbservicepack kbDatabase kbMFC kbVC600 kbVS600sp3fix kbGrpVCDB |
Last Reviewed: May 19, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |