Article ID: 157876
Article Last Modified on 11/21/2006
void CRecordset::SetNullParamStatus(DWORD nParam)
{
ASSERT(nParam < m_nParams); // <= Line 4055
m_pbParamFlags[nParam] |= AFX_SQL_FIELD_FLAG_NULL;
}
void CRecordset::ClearNullParamStatus(DWORD nParam)
{
ASSERT(nParam < m_nParams); // <= Line 4062
m_pbParamFlags[nParam] &= ~AFX_SQL_FIELD_FLAG_NULL;
}
case CFieldExchange::NameValue:
...
// Fall through
case CFieldExchange::Value:
...
// Add the member address to the param map
pFX->m_prs->m_mapParamIndex.SetAt(&value, (void*)nField);
A subsequent call to SetFieldNull() will try to determine whether the field
is a parameter by checking the index returned by GetBoundParamIndex(). An
index >= 0 implies that the field is a parameter:
void CRecordset::SetFieldNull(void* pv, BOOL bNull)
{
...
int nIndex = GetBoundParamIndex(pv);
if (nIndex >= 0)
{
if (bNull)
SetNullParamStatus(nIndex);
else
ClearNullParamStatus(nIndex);
return;
}
... // Handle the case where the field is not a parameter
}
Because the RFX function incorrectly added the field to the parameter map,
an index >= 0 is returned by GetBoundParamIndex(). Because of this,
SetFieldNull() incorrectly calls the function to set or clear the Null
parameter status rather than the Null field status. If the index returned
by GetBoundParamIndex() is less the member variable CRecordset::m_nParams,
then the assert will occur:
ASSERT(nParam < m_nParams);
#include"stdafx.h"at the top of your new .cpp file, and include the .cpp file in your project.
// pFX->m_prs->m_mapParamIndex.SetAt(&value, (void*)nField);
Additional query words: crash gpf
Keywords: kbbug kbdatabase kbfix kbnoupdate kbvc500fix KB157876