EMSErrors traped in dbMonitor
EMSErrors traped in dbMonitor
Win 7 ultimate
SDAC 4.80.0.60
Delphi 7
I have an application running on several databases.
I create a TMSSQLMonitor with [moDBMonitor] in Options.
If the trapped data comes from a component, through the component's connection I can point to what database is talking about, but when is trapping an error I can't identify from which database is coming.
Is there any possibility to retrieve the database name?
Thank you
SDAC 4.80.0.60
Delphi 7
I have an application running on several databases.
I create a TMSSQLMonitor with [moDBMonitor] in Options.
If the trapped data comes from a component, through the component's connection I can point to what database is talking about, but when is trapping an error I can't identify from which database is coming.
Is there any possibility to retrieve the database name?
Thank you
In OnSQL event of the TMSSQLMonitor, the Sender could be cast as specific component (TMSConnection, TCustomDADataSet, TCustomDASQL etc) and through the connection property of that component I can get the name of the database from where comes the query text and I can formatted accordingly; but if the Sender is a EMSError I can't retrieve the database name.
I was wondering if there is a possibility to do that.
Thank you
I was wondering if there is a possibility to do that.
Thank you
You can use the following code:
Code: Select all
procedure TMainForm.MSSQLMonitorSQL(Sender: TObject; Text: String;
Flag: TDATraceFlag);
var
obj: TObject;
begin
if Sender is EMSError then begin
obj := EMSError(Sender).Component;
if obj is TMSSQL then
ShowMessage(TMSSQL(obj).Connection.Database);
end;
end;