Page 1 of 1

How to handle the Session.OnError

Posted: Thu 08 Dec 2005 10:10
by huseyin
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.

Posted: Fri 09 Dec 2005 12:10
by Challenger
To handle connection errors use TOraSesssion.OnError event handler and
check ErrorCode property of EDAError. Oracle error codes you can find in
Oracle help.

Posted: Fri 09 Dec 2005 13:06
by huseyin
Does ErrorCode give the number only in ORA-***** exceptions?

Posted: Fri 09 Dec 2005 13:43
by Challenger
No. To get oracle errors you should check that object E is an instance of EOraError class.