Error Handling With Sender Object

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
vkamadan
Posts: 9
Joined: Thu 26 Jul 2007 05:57

Error Handling With Sender Object

Post by vkamadan » Thu 26 Jul 2007 06:04

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.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 26 Jul 2007 12:20

Try this code:

Code: Select all

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

vkamadan
Posts: 9
Joined: Thu 26 Jul 2007 05:57

Post by vkamadan » Thu 26 Jul 2007 13:54

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.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 26 Jul 2007 14:11

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.

vkamadan
Posts: 9
Joined: Thu 26 Jul 2007 05:57

Post by vkamadan » Thu 26 Jul 2007 14:16

Okey thanks.
My Best Regards

Post Reply