Page 1 of 1

Exception handling with Delphi7

Posted: Wed 20 Sep 2006 11:15
by vortex77
Hi,
i'm working on app. that uses myDAC (v4.3) and Delphi7 and have question regarding myDAC except handling.
How to override myDAC exception handler? I would like to make my own handler (mostly to show my messages like 'wrong password, try again'), but in my try block myDAC already handles exceptions and my except block can't see any exception.
One example would be - entering wrong password or username while trying to connect to DB.

Posted: Wed 20 Sep 2006 16:12
by RH
Hi

one way arround this would be to disable LoginPrompt:

try
MyConnection1.LoginPrompt:= false;
MyConnection1.Connect;
except
on E: exception do
showmessage(E.Message);
end;

then you can itercept the exception. If login prompt is enabled, then I have the same problem too. Hope this helps

Re: Exception handling with Delphi7

Posted: Wed 20 Sep 2006 17:38
by kpowick
vortex77 wrote:Hi,
How to override myDAC exception handler?
You can easily do this with a product like madExcept (http://www.madshi.net).

It allows you to register your own handlers for specific exceptions, thus giving you full control over the exception handling process. It's a nice product, inexpensive, great support and you can download a free trial.

--
Kevin Powick

Posted: Thu 21 Sep 2006 06:15
by vortex77
thanks.
I've tryed LoginPrompt off but it doesnt help. I'm yet to download madExcept so i hope it'll work. :?

Posted: Thu 21 Sep 2006 14:04
by Antaeus
Try handling MyConnection.OnError event. This event is raised on all errors that concern working with server.