Article ID: 149392
Article Last Modified on 10/24/2003
C:\MSDEV\DAOSDK\INCLUDE
dbdao3.lib - ANSI Release export library
dbdao3d.lib - ANSI Debug export library
dbdao3u.lib - UNICODE Release export library
dbdao3ud.lib - UNICODE Debug export library
#include <afxole.h> #include <dbdao.h> #include <dbdaoerr.h>Failure to do so will generate the following errors (among others) in Dbdao.h: When an error is encountered, the dbDao classes will throw an instance of the CdbException class. This is really just a flag, the actual error information is included in the Errors collection of the CdbDBEngine class. The following code demonstrates how to extract this information for each error object in the collection. The collection is refreshed each time dbDao encounters an error.
CdbDBEngine *pEng;
// Code to instantiate pEng goes here
try
{
// Code to use dbDao in a way that generates an error goes here
}
catch( CdbException e )
{
for( long l = 0; l < pEng->Errors.GetCount(); l++ )
{
TRACE( "\t Error #%ld: #%ld -- %s\n",
l,
pEng->Errors[l].GetNumber(),
pEng->Errors[l].GetDescription() );
}
}
catch(CException *e)
{
TRACE( "MFC Exception\n" );
e->Delete();
}
catch(...)
{
TRACE( "Win32 Exception\n" );
}Keywords: kbhowto kbdatabase kbprogramming kbcode KB149392