BUG: Error in Requery When Set Null Date Parameter to Not NullLast reviewed: July 31, 1997Article ID: Q166756 |
The information in this article applies to:
SYMPTOMSWhen you set a previously Null date parameter to no longer be Null, using either CRecordset::SetParamNull() or CRecordset::SetFieldNull(), it may cause a subsequent call to CRecordset::Requery() to generate the following exception:
Invalid string or buffer length CAUSEDuring a call to CRecordset::Open, no memory is allocated for a Null date field. However, CRecordset::Requery expects the memory to exist.
RESOLUTIONCreate a replacement for the RFX_Date function which always allocates memory for the date field. See the MORE INFORMATION section.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.
MORE INFORMATIONThis problem only occurs with the version of RFX_Date that takes a CTime argument.
Steps to Reproduce BehaviorThe following code displays the problem for a predefined query named Query1, which takes one date parameter:
CMySet rs; try { rs.SetParamNull( 0, TRUE ); rs.Open( CRecordset::snapshot, "{Call Query1(?)}" ); rs.m_paramDate = CTime( 1996, 10, 13, 0, 0, 0 ); rs.SetParamNull( 0, FALSE ); rs.Requery(); } catch( CDBException* e ) { AfxMessageBox( e->m_strError ); e->Delete(); } rs.Close(); Steps to Replace the RFX_Date FunctionThe following steps detail one method of making the needed changes in RFX_Date:
Keywords : MfcDatabase vcbuglist500 kbprg kbbuglist Technology : kbMfc Version : 5.0 Platform : NT WINDOWS |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |