Hi,
this code works fine (Zeos).
procedure TForm1.Button1Click(Sender: TObject);
begin
if ZConnection1.Connected then begin
ZQuery1.Active:=False;
ZConnection1.Connected:=False;
end else begin
ZConnection1.Connected:=True;
ZQuery1.Active:=True;
end;
end;
first click on button -> 1 access is created
second click -> access is closed
the same procedure with TPQConnection and TSQLQuery create 2 hits (first click)
second click 1 access is closed, 1 is active
I tried follow code to delete the second
procedure TForm1.Button1Click(Sender: TObject);
begin
if PQConnection1.Connected then begin
SQLQuery1.Active:=False;
SQLQuery1.Close;
SQLQuery1.Destroy;
SQLQuery1.Free;
PQConnection1.CloseDataSets;
PQConnection1.CloseTransactions;
PQConnection1.Connected:=False;
PQConnection1.Close;
PQConnection1.Free;
end else begin
PQConnection1.Connected:=True;
SQLQuery1.Active:=True;
end;
end;
nothing works
Does anybody know, how to close the second access?
I add two projects, where you can see, what I mean (you have to enter your databasename, username, password and query.sql)
Maybe it´s a bug, I use Lazarus 1.1 r42453 FPC 2.7.1 i386-win32-win32/win64
Here is a crosspost
http://www.lazarusforum.de/viewtopic.php?f=17&t=7218