CString sql;
sql.Format("insert into sms values ('%s','%s')",strName,strMessage);
try
{
((CPowerViewApp*)AfxGetApp())->g_pDataBase->ExecuteSQL(sql);
}
catch(CDBException* e)
{
AfxMessageBox(e->m_strError);
}
我的sms表不存在,为什么不执行catch中的语句报错呢!
请各位大仙帮忙
sql.Format("insert into sms values ('%s','%s')",strName,strMessage);
try
{
((CPowerViewApp*)AfxGetApp())->g_pDataBase->ExecuteSQL(sql);
}
catch(CDBException* e)
{
AfxMessageBox(e->m_strError);
}
我的sms表不存在,为什么不执行catch中的语句报错呢!
请各位大仙帮忙
sql.Format("insert into sms values ('%s','%s')",strName,strMessage);try
{
((CPowerViewApp*)AfxGetApp())->g_pDataBase->ExecuteSQL(sql);
}
catch(_com_error e)
{
CString errormessage;
errormessage.Format("錯誤信息:%s",e.ErrorMessage());
AfxMessageBox(errormessage);
}//应该是这样写的.
在不确定会抛出何种异常时,可以简单地以catch(...) 来处理,表示捕捉所有异常。
我换了一种方法,
用open ,这样就报异常。