Exceptions are errorenous program states from which it is still possible to close the program gracefully without losing data or crashing the system. In C++, you can handle raised exceptions by using a try - catch block. You write the code you wish to execute in the try block, and then write either a conditional (specific exception) catch block or a generic one, if available. Here is an example of handling an SQL-query exception:
try
{
CRecordset myRecordset(&db);
myRecordset.Open(...);
}
catch ( CDBException* e )
{
// If an exception is raised
AfxMessageBox( e->m_strError, MB_OK );
e->Delete();
}
For more hands-on information and how to write your own routines that raise exceptions, see MSDN Library for Exception handling topics (C++)[^]. Hope this helps, Antti Keskinen ---------------------------------------------- The definition of impossible is strictly dependant on what we think is possible.