Error while closing form with TZConnection.Connected=False

Code patches written by our users to solve certain "problems" that were not solved, yet.

Moderators: gto, cipto_kh, EgonHugeist, mdaems

Post Reply
dayat
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 01.03.2007, 04:41
Location: Banda Aceh
Contact:

Error while closing form with TZConnection.Connected=False

Post by dayat »

Hi, I was edited this code for my problem in home. See the code below, I replace:

function TZConnection.GetInTransaction: Boolean;
begin
CheckConnected;
Result := not FAutoCommit or (FExplicitTransactionCounter > 0);
end;

with:

function TZConnection.GetInTransaction: Boolean;
begin
try
CheckConnected;
except
Result:=False;
Exit;
end;
Result := not FAutoCommit or (FExplicitTransactionCounter > 0);
end;

I've the story with this problem :shock: . Sometime my application fail when connect to database, application still running, but property of Connected=False. When I closing the application, method of CheckConnected raising the error, and my application can't close :cry: , I must terminated with task manager :twisted: , or write code Application.Terminate.

You can try for get the error message with fail login, such enter the wrong of user name or password, until the main form showing. And then try close the main form, the moment a method GetInTransaction executing method CheckConnected and raising the error.

I use postgresql-8.1, Turbo Delphi and 6.6.2-RC version of Zeos.

:idea: Or you have other solution, my be any code must be edited, but not this code.

Thanks
dayat
Post Reply