Page 1 of 1

Continue after TOraSession.OnError

Posted: Thu 13 Jul 2006 16:25
by rstubbe
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?

Posted: Wed 19 Jul 2006 14:36
by Plash
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.

Posted: Wed 19 Jul 2006 15:39
by rstubbe
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