By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,778 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,778 IT Pros & Developers. It's quick & easy.

Error handling in C++(ADO)

P: n/a
im not this experienced in C++(Java is
my background..) and
now I'm really needing some help...
I don't know how to catch an Exception
in a database test-programm (C++Builder).
I'm opening a database(access) with a TADOConnection, which
is fine, when the connection-string is ok.
But I want to take care of the situation the path(maybe from a ini-file)
is wrong.
When testing this, I always get an EOleException-Popup.
The following code didn't work(I tried more than this, nothing
For example, when asking for 'if(!con1->Connected )' I already
get the exception popup.
Trying to catch a EOleException won't work(type name expected...)
Thanks for any help!
con1->ConnectionString =
"D:\\programming\\c++\\wu\\cbuilder\\tests\\db\\db \\db1.mdb";
con1->Provider = "Microsoft.Jet.OLEDB.4.0";
con1->Open() ;
if(!con1->Connected ){
throw Exception("Shit");
catch(EADOError &err){
ShowMessage(err.Message );
return false;
catch(Exception &e){
ShowMessage(e.Message );
return false;

return false;
return true;
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.