MessageBox(NULL,"关闭数据库连接异常","关闭异常",MB_OK|MB_ICONINFORMATION);
#endif
break;
case ErrFormTanslation:
#if def _DEBUG
try
{
for(long i=0;i<(*m_pConn)->Errors->Count;i++)
{
ErrorPtr pErr;
pErr=(*m_pConn)->Errors->GetItem(i);
AfxMessageBox(pErr->Description);
}
}
catch()
{
MessageBox(NULL,"数据库连接未知错误,无法捕捉具体错误信息!","错误",MB_ICONINFORMATION);
}
#else
MessageBox(NULL,"数据库执行任务失败,请检查数据库。","任务失败",MB_OK|MB_ICONINFORMATION);
#endif
break;
default:
break;
}
}
/////////////// CRecordsetValus
CBBRstValues::CBBRstValues()
{
;
}
CBBRstValues::CBBRstValues(_ConnectionPtr* pConn,_RecordsetPtr* pRs)
{
ASSERT(pConn);
ASSERT(pRs);
m_prsThis=pRs;
m_pConn=pConn;
}
CBBRstValues::CBBRstValues(CBBAdoConnection* pBBadoConn,_RecordsetPtr* pRs)
{
CBBRstValues(pBBadoConn->GetConnection(),pRs);
}
CBBRstValues::~CBBRstValues()
{
;
}
void CBBRstValues::InitConnectAndRst(_ConnectionPtr *pConn, _RecordsetPtr *pRs)
{
ASSERT(pConn);
ASSERT(pRs);
m_prsThis=pRs;
m_pConn=pConn;
}
void CBBRstValues::InitConnectAndRst(CBBAdoConnection *pBBAdoConn, _RecordsetPtr *pRs)
{
InitConnectAndRst(pBBAdoConn->GetConnection(),pRs);
}
BOOL CBBRstValues::GetValueLong(long *lVal, _variant_t &vIndex)
{
_variant_t value;
try{
if((*m_prsThis)==NULL||(*m_prsThis)->State==adStateClosed)
{
#ifdef _DEBUG
AfxMessageBox("记录集未打开!");
#else
MessageBox(NULL,"无法读取数据库
资料,可能数据库连接已经断开,请重新连接、然后重试。","连接问题",MB_ICONINFORMATION);
#endif
return FALSE;
}
if((*m_prsThis)->adoEOF)
{
lVal=0;
return FALSE;
}
value=(*m_prsThis)->GetCollect(vIndex);
}
catch(_com_error)
{
ReportError();
return FALSE;
}
catch()
{
AfxMessageBox("数据库字段访问未知错误!请检查数据库是否改动。",MB_ICONINFORMATION);
return FALSE;
}
if(VerifyVTData(value))
{
*lVal = long(value);
}
else
{
*lVal=0;
}
return TRUE;
}
BOOL CBBRstValues::GetValueStr(char *cVal, _variant_t &vIndex, int nFieldLen)
{
char * c=NULL;
_variant_t value;
DATE dt;
CString str;
COleDateTime da;
// 检查是数组
// VERIFY(sizeof(cVal)<1);
memset(cVal,0,sizeof(cVal));
try
{
if((*m_prsThis)==NULL||(*m_prsThis)->State==adStateClosed)
{
#ifdef _DEBUG
AfxMessageBox("记录集未打开!");
#else
&nbs