How to handle the Session.OnError

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
huseyin
Posts: 2
Joined: Thu 08 Dec 2005 09:51
Location: ankara
Contact:

How to handle the Session.OnError

Post by huseyin » Thu 08 Dec 2005 10:10

I'm trying to handle the connection errors on my program. I wrote this code in OraSession1.OnError:

ShowMessage('Connection Error. Program will close.');
Application.Terminate;

But this event is also fired when there are other errors, like bad queries, field not found, etc..

Is there a better way to handle connection problems?
I tried to check E.Errorcode but there is nothing in the help about the error codes.

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Fri 09 Dec 2005 12:10

To handle connection errors use TOraSesssion.OnError event handler and
check ErrorCode property of EDAError. Oracle error codes you can find in
Oracle help.

huseyin
Posts: 2
Joined: Thu 08 Dec 2005 09:51
Location: ankara
Contact:

Post by huseyin » Fri 09 Dec 2005 13:06

Does ErrorCode give the number only in ORA-***** exceptions?

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Fri 09 Dec 2005 13:43

No. To get oracle errors you should check that object E is an instance of EOraError class.

Post Reply