When trying to execute the ExecProc method of a TZConnection I get the following error:
"raised exception class ESQLException with message 'SQL Error: invalid statement handle. Error Code -901. Unsuccessful execution caused by system error that does not preclude successful execution of subsequent statements."
The funny thing is that after the exception is raised the application continues and the table in the database is updated correctly. Is there any reason why this is happening? Am I being very stupid and missing
something small? Any help would be greatly appreciated.
I'm using Delphi 7, Firebird 2.0 and ZEOSLIB 6.6.1
Procedure on the database
[font=Courier New]
CREATE PROCEDURE UpdateLogin(
UserId CHAR(10),
UserRole CHAR(8))
AS
BEGIN
UPDATE user_login
SET last_login = 'NOW'
WHERE user_id = :UserId
AND user_role = :UserRole;
END[/font]
In Delphi I have the following code in the datamodule:
1. There is a TZConnection component
Properties: TIL = tiRepeatableRead; AutoCommit = True;
(Even when changing the properties to TIL = tiCommittedRead and
AutoCommit = False the result remains the same)
2. There is a TZStoredProcedure component
Properties:
StoredProcName = UPDATELOGIN
Name = spUpdateLoging
[font=Courier New]
procedure UpdateLogin(dbName: String; userName: String; userPassword: String; userRole: String);
begin
with cnxDatabase do
begin
Disconnect;
Database := dbName;
User := userName;
Password := userPassword;
Properties.Add('Rolename=' + userRole);
Connect;
end;
with spUpdateLogin do
begin
Params[0].Value := userName;
Params[1].Value := userRole;
cnxDatabase.StartTransaction;
try
ExecProc;
cnxDatabase.Commit;
except on E:Exception do
cnxDatabase.Rollback;
end;
end;
end;
[/font]
The error when setting break-points occurs when ExecProc is called.
Any help would be greatly appreciated.
Thanks,
Antz
Error when calling the TZConnection.ExecProc method
Moderators: gto, cipto_kh, EgonHugeist