Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database Exceptions

Status
Not open for further replies.

dcusick

Technical User
Aug 9, 2000
271
US
What's up everyone? I have a program I'm writing and it accesses a database. I access it the same way in a few different classes. Here's the code...

Code:
BOOL CContributionInfo::ConnectToDatabase()
{
	BOOL bRet = TRUE;
	try
	{
		m_db.Open(	_T( "SAFARI" ), 
			FALSE,
			FALSE,
			_T( "ODBC;UID=copeland;PWD=cope3x" ),
			TRUE );
	}
	catch(CDBException &e)
	{
		char szErr[ERR_LEN];
		memset(szErr, 0 , ERR_LEN);
		e.GetErrorMessage(szErr, ERR_LEN-1);
		AfxMessageBox(szErr);
		bRet = FALSE;
	}
	catch(...)
	{
		bRet = FALSE;
	}
	return bRet;
}

The problem is, I keep getting an exception... and it goes into the catch(...) statement... How can I tell what the error is?
 
there could be one milion of reasons why you may get an exeption. Use the debugger to see exactly what is inside.
By the way, why are you wrapping MFC classes? MFC already is a wrapper.

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top