Page 1 of 1

Error Handling With Sender Object

Posted: Thu 26 Jul 2007 06:04
by vkamadan
Hi,
I'm working MyDAC 4.40.0.25 with MySQL 5.0
I want catch Error Generated object name.
What can I do ?

Sample :

Code: Select all

procedure MyConnection1Error(Sender: TObject; E: EDAError;
  var Fail: Boolean);
begin
 ShowMessage( E.SenderObjectName); //MyQuery1
end;
Best Regards.

Posted: Thu 26 Jul 2007 12:20
by Antaeus
Try this code:

Code: Select all

if e.Component is TComponent then
  ShowMessage(TComponent(e.Component).Name);

Posted: Thu 26 Jul 2007 13:54
by vkamadan
Hi,
E.Component is Undeclared Identifier.
Your code did not work.
There is no properties of E that called Component.

In fact, it has to work like dbmonitor but it dosn't work.

Posted: Thu 26 Jul 2007 14:11
by Antaeus
You are right this property of EDAError is not present in MyDAC 4 as it was added in MyDAC 5. You can use a third-party tool to trace exceptions in your application, or upgrade to MyDAC 5.

Posted: Thu 26 Jul 2007 14:16
by vkamadan
Okey thanks.
My Best Regards