Article ID: 125727
Article Last Modified on 11/21/2006
case BindFieldForUpdate:
if (!m_prs->IsFieldFlagDirty(nField, m_nFieldType))
{
// If field is not dirty, set bound length to SQL_IGNORE
// for SQLSetPos updates
*plLength = SQL_IGNORE;
}
else if ((m_prs->m_nEditMode == CRecordset::addnew) &&
(!m_prs->IsFieldFlagNull(nField, m_nFieldType)))
{
// plLength always set to SQL_NULL_DATA in AddNew mode
*plLength = cbValue;
}
return;
The second If statement shouldn't check for only CRecordset::addnew
because this also applies to updates.
void RFX_Text2(CFieldExchange* pFX, const char *szName,
CString& value, int nMaxLength=255, int nColumnType=SQL_VARCHAR);
****
void RFX_Text2(CFieldExchange* pFX, const char *szName,
CString& value, int nMaxLength, int nColumnType)
{
ASSERT(AfxIsValidAddress(pFX, sizeof(CFieldExchange)));
ASSERT(AfxIsValidString(szName));
ASSERT(AfxIsValidAddress(&value, sizeof(CString)));
if (pFX->m_nOperation==CFieldExchange::BindFieldForUpdate)
{
UINT nField;
if (!pFX->IsFieldType(&nField))
return;
LONG* plLength = pFX->m_prs->GetFieldLength(pFX);
if (!pFX->m_prs->IsFieldFlagDirty(nField, pFX->m_nFieldType))
{
// If field is not dirty, set bound length to SQL_IGNORE
// for SQLSetPos updates
*plLength = SQL_IGNORE;
}
else if (!pFX->m_prs->IsFieldFlagNull(nField, pFX->m_nFieldType))
{
// plLength always set to SQL_NULL_DATA in AddNew mode
*plLength = value.GetLength();
}
return;
}
RFX_Text(pFX, szName,value, nMaxLength,nColumnType);
}
****
Additional query words: 2.00 3.00
Keywords: kbbug kbdatabase kbfix KB125727