Пример #1
0
void DisplayDaoException(CDaoException* e)
{
    CString strMsg;
    if (e->m_pErrorInfo!=NULL)
    {
        strMsg.Format(
            _T("%s   (%d)\n\n")
            _T("Would you like to see help?"),
            (LPCTSTR)e->m_pErrorInfo->m_strDescription,
            e->m_pErrorInfo->m_lErrorCode);

        if (AfxMessageBox(strMsg, MB_YESNO) == IDYES)
        {
            WinHelp(GetDesktopWindow(),
                    e->m_pErrorInfo->m_strHelpFile,
                    HELP_CONTEXT,
                    e->m_pErrorInfo->m_lHelpContext);
        }
    }
    else
    {
        strMsg.Format(
            _T("ERROR:CDaoException\n\n")
            _T("SCODE_CODE		=%d\n")
            _T("SCODE_FACILITY	=%d\n")
            _T("SCODE_SEVERITY	=%d\n")
            _T("ResultFromScode	=%d\n"),
            SCODE_CODE		(e->m_scode),
            SCODE_FACILITY	(e->m_scode),
            SCODE_SEVERITY	(e->m_scode),
            ResultFromScode (e->m_scode));
        AfxMessageBox(strMsg);
    }
}
Пример #2
0
LPCTSTR AFXAPI AfxGetSeverityString(SCODE sc)
{
	static const TCHAR* rgszSEVERITY[] =
	{
		_T("SEVERITY_SUCCESS"),
		_T("SEVERITY_ERROR"),
	};
	return rgszSEVERITY[SCODE_SEVERITY(sc)];
}
Пример #3
0
//	Fehler-Behandlung realisieren
void DisplayDaoException(CDaoException* e)
{
	ASSERT (NULL != e);
	ASSERT (e -> IsKindOf (RUNTIME_CLASS(CDaoException)));

	CString strMsg;
	if (e->m_pErrorInfo!=NULL)
	{
		CString strCaption;
		strCaption.Format(_T("Datenbankfehler %ld"), e->m_pErrorInfo->m_lErrorCode);
		strMsg.Format(
			_T("\"%s\"\n\n")
			_T("Hilfe zum Fehler aufrufen ?"),
			(LPCTSTR)e->m_pErrorInfo->m_strDescription);

		if (::MessageBox(GetDesktopWindow(), strMsg, strCaption, 
						 MB_YESNO|MB_ICONQUESTION) == IDYES)
		{
			CString strHelpFile;
			VERIFY (strHelpFile.LoadString (IDS_ERROR_HELP_FILE_NAME));
			::WinHelp(GetDesktopWindow(),
					  // e->m_pErrorInfo->m_strHelpFile,
					  strHelpFile,
					  HELP_CONTEXT,
					  e->m_pErrorInfo->m_lHelpContext);
		}
	}
	else
	{
		strMsg.Format(
			_T("Fehler: CDaoException\n\n")
			_T("SCODE_CODE		=%d\n")	
			_T("SCODE_FACILITY	=%d\n")	
			_T("SCODE_SEVERITY	=%d\n")	
			_T("ResultFromScode	=%d\n"),
			SCODE_CODE		(e->m_scode),
			SCODE_FACILITY	(e->m_scode),
			SCODE_SEVERITY	(e->m_scode),
			ResultFromScode (e->m_scode));
		::MessageBox(GetDesktopWindow(), strMsg, AfxGetAppName (), 
					  MB_OK|MB_ICONINFORMATION);
	}
}