473,386 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Error handling in C++(ADO)

Hi,
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
worked!!)
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!
------------
try{
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;
}

catch(...){
return false;
}
return true;
Jul 19 '05 #1
0 2364

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Erland Sommarskog | last post by:
I've added two more articles to my web site. Both are about error handling in SQL Server. I also cover ADO to some extent. The articles are "Error Handling in SQL Server - a Background",...
1
by: Jon LaRosa | last post by:
Hi all - I have a web application and I want to be able to do some basic error handling. For example, here is one error I would like to catch and display in a useful way for the user: ...
0
by: Jon LaRosa | last post by:
Hi all - I have a web application and I want to be able to do some basic error handling. For example, here is one error I would like to catch and display in a useful way for the user:...
5
by: wackyphill | last post by:
I have a table I insert a record into to give access to a user. It uses primary keys so duplicates are not allowed, so trying to add a record for a user more than once is not allowed. In my .NET...
8
by: Erencans | last post by:
Hi to all, I want to error handling in ASP. But i think that ASP is not enough for error handling. I have got two chance. 1. I can prapare an error page and control throught IIS. 2. I can use on...
2
by: Steve Jorgensen | last post by:
When writing VB or VBA code that works with databases or other external libraries that cannot be trusted to automatically do the right thing when references to their objects are arbitrarily...
3
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records...
5
by: Ivan Weiss | last post by:
I am getting the following error from my error handling code: 5 - Expected query name after EXECUTE.. from the following code: Public Sub insert(ByVal argSql As String) Dim myConnection As...
5
by: tascien | last post by:
Hi, when i use this code: SqlConn.Open() SqlCmd.Connection = SqlConn SqlCmd.CommandText = sqlCommand If Not CmdTimeOut < 0 Then SqlCmd.CommandTimeout = CmdTimeOut Dim ret =...
33
by: Anthony England | last post by:
I am considering general error handling routines and have written a sample function to look up an ID in a table. The function returns True if it can find the ID and create a recordset based on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.