4,018
社区成员




m_pRecordset->AddNew(); //添加新记录
m_pRecordset->PutCollect("ORGCODE",_variant_t(m_org_code));
m_pRecordset->PutCollect("SDATE",_variant_t(m_file_date));
m_pRecordset->PutCollect("FINISH",_variant_t((long)1));
m_pRecordset->Update();
try
{
m_pRecordset->PutCollect(varFieldName,varValue);
m_pRecordset->Update();
return TRUE;
}
catch(_com_error &e)
{
LogProviderError(m_pConnection);
LogComError(e);
}
void CDBAccessWithAdo::LogProviderError(_ConnectionPtr pConnection)
{
TRACE_FUNCTION_DEBUG
// 错误信息
ErrorPtr pErr = NULL;
CString errorStr;
LONG nCount;
// 记录连接错误信息到日志系统
if((nCount = pConnection->Errors->Count) > 0)
{
for(LONG i=0; i<nCount; i++)
{
pErr = pConnection->Errors->GetItem(i);
errorStr.Format(_T("Error number: %x\t%s"), pErr->Number, (const TCHAR*)pErr->Description);
LOG_ERROR(errorStr.GetBuffer());
}
}
}
void CDBAccessWithAdo::LogComError(_com_error &e)
{
TRACE_FUNCTION_DEBUG
// 错误信息
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
CString errorStr;
// 记录COM异常信息到日志系统
errorStr = _T("Error\n");
errorStr.AppendFormat(_T("Code = %08lx\n"), e.Error());
errorStr.AppendFormat(_T("Code meaning = %s\n"), e.ErrorMessage() );
errorStr.AppendFormat(_T("Source = %s\n"), (const TCHAR*) bstrSource );
errorStr.AppendFormat(_T("Description = %s\n"), (const TCHAR*)bstrDescription );
LOG_ERROR(errorStr.GetBuffer());
}