64,646
社区成员
发帖
与我相关
我的任务
分享
CMySqlDatabase mysql;
bool bLink = GetConnectSQL(mysql);
bool bAlive = mysql.IsConnAlive();
if ( bLink && bAlive )
{
do
{
try
{
//循环执行SQL语句
}
catch (CException* e)
{
//请问,这里应该怎么写,才能捕获到错误描述。
}
}
while ();
}
try
{
//循环执行SQL语句
}
catch (CException* e) //mfc的异常
{
char strError[MAX_PATH] = {0};
e->GetErrorMessage( strError, MAX_PATH );
MessageBox( strError, "错误", MB_ICONSTOP );
}
catch (...) //非mfc的异常
{
DWORD dwError = GetLastError();
char strError[MAX_PATH] = {0};
sprintf( strError, "代码:%d", dwError );
MessageBox( strError, "错误", MB_ICONSTOP );
}