Continue after TOraSession.OnError

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
rstubbe
Posts: 4
Joined: Tue 11 Jul 2006 15:04

Continue after TOraSession.OnError

Post by rstubbe » Thu 13 Jul 2006 16:25

I am working on a project, where a user should be able to check the login details by clicking a button.

To do that, I use the TOraSession.Connect() and use the OnError to report the possible problem.

However the application does not continue the program where it left off e.g. after the connect().

My intention was to check TOraSession->Connected and depending on that do some more processing.

Is it possible to tell the TOraSession OnError to continue where it left of?

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 19 Jul 2006 14:36

When error occurs on connecting to database, method TOraSession.Connect first calls OnError event handler and then it raises an exception. So if you want to continue execution of your code in such situation you should call Connect method from try..except block to catch the exception.

rstubbe
Posts: 4
Joined: Tue 11 Jul 2006 15:04

Post by rstubbe » Wed 19 Jul 2006 15:39

I figured out that you can suppress the exeprion by setting
Fail = flase;
in the error routine, and having both the error routine and the normal routine point to the next subroutine where the program continues.

It gives you a lot of subroutines but it works.

Thanks

Post Reply