ExecuteDirect: where to read error message ?

Forum related to Firebird

Moderators: gto, cipto_kh, EgonHugeist

derles
Fresh Boarder
Fresh Boarder
Posts: 2
Joined: 09.07.2013, 22:30

ExecuteDirect: where to read error message ?

Postby derles » 11.07.2013, 17:30

Hello.

I?m using Zeos with Lazarus and Firebird.

When I needed to execute an INSERT, UPDATE or DELETE sentence, I usually used a ZQuery component, with the ExecSQL method.
As in this code portion: (sQ variable contains mi SQL sentence).

try
zQuery01.SQL.Text:= sQ;
zQuery01.ExecSQL;
Result := True;
except
on E:Exception do
begin
Result := False;
ShowMessage('An error occurs: '+E.Message);
end;
end;

Now I'm trying to use ZConnection.ExecuteDirect instead ZQuery.ExecSQL. It looks simplier.
But the problem I find is this: when the sql sentence was not succesful (syntax error, or PK duplicates o something else), I don't know how to capture the error to show the error message.
I mean: the ExecuteDirect returns False, but I think no exception is thrown. Is this correct? So, where can I find the error message returned? is this possible?

Thanks.

Return to “Firebird”

Who is online

Users browsing this forum: No registered users and 1 guest