->put_ConnectionTimeout(lTimeOut);
}
int CBBAdoConnection::SetCommTimeOut(long lTimeOut)
{
return (*m_pConn)->put_CommandTimeout(lTimeOut);
}
// 报告错误
void CBBAdoConnection::ReportError(int nERRORfrom)
{
switch(nERRORfrom)
{
case ErrFormOpenConnsction:
#ifdef _DEBUG // 调试试时显示相应的错误信息
try
{
for(long l=0;l<(*m_pConn)->Errors->Count;l++)
{
ErrorPtr pErr;
pErr=(*m_pConn)->Errors->GetItem(l);
CString str;
str=(char*)pErr->Description;
MessageBox(NULL,str,"连接失败",MB_OK|MB_ICONINFORMATION);
}
}
catch()
{
MessageBox(NULL,"数据库连接未知错误,无法捕捉具体错误信息!","错误",MB_ICONINFORMATION);
}
#else
MessageBox(NULL,"连接数据失败,请检查网络和数据库设置是否正确","连接失败",MB_OK|MB_ICONINFORMATION);
#endif
break;
case ErrFromOpenRecordset:
#ifdef _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;
case ErrFormCloseConnection:
#ifdef _DEBUG // 调试时显示相应的错误信息
try
{
for(long l=0;l<(*m_pConn)->Errors->Count;l++)
{
ErrorPtr pErr;
pErr=(*m_pConn)->Errors->GetItem(l);
CString str;
str=(char*)pErr->Description;
MessageBox(NULL,str,"连接失败",MB_OK|MB_ICONINFORMATION);
}
}
catch()
{
MessageBox(NULL,"数据库连接未知错误,无法捕捉具体错误信息!","错误",MB_ICONINFORMATION);
}
#else
;//