Page 1 of 1

catch EMSError

Posted: Fri 03 Jun 2005 12:25
by Stupindo
Hi,

I use SDAC with D7 and now I have a problem with processing error events if occured.
So, I have something like that:
//**************************
try
TMSQuery(ExecQuery).Execute;
except
on E : EMSError do
begin
for I := 0 to E.ErrorCount - 1 do // Iterate
ShowMessage(E.Errors.Message);
end
else
ShowMessage('Unknown Error')
end;
//**************************

And I get 'Unknown Error' message every time error occures. An that is a problem.
I've found that EAbort error object throwed every time in this function.
Is it known issue? Can anyone help?

p.s.
In SDAC Help I found description for EOLEDBError object and there is a text : "Keep in mind, if MSConnection.Connect was called from another thread than this event, the text of the message can be incomplete."
May be it is a key for solving because of I use different threads in my application?

Posted: Fri 03 Jun 2005 14:15
by Ikar
Use the code

Code: Select all

try
TMSQuery(ExecQuery).Execute;
except
 on E : Exception do
   ShowMessage(E.Message+#$D#$A+E.ClassName)
else
 ShowMessage(\Unknown Error\)
end;
to get type of the error.

> May be it is a key for solving because of I use different threads in my
> application?


Possible. Pay attention that each thread must have its own set of SDAC components (TMSConnection + TMSQuery + etc).

Posted: Thu 16 Jun 2005 09:39
by Stupindo
So, I investigated that probably Execute method called really from another thread.
Are there ways to solve this problem without full rewriting of complex system to use not different threads?