To confirm that it wasn't my program I wrote a small test which also seems to exhibit the same behaviour. Whilst this code is minimal, it essentially does the same thing. Could someone please let me know if I am missing something?
The program simply has a timer, button, edit box, TZConnection and TZQuery on it.
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Db, ZAbstractRODataset, ZAbstractDataset, ZDataset, ZConnection,
ExtCtrls;
type
TForm1 = class(TForm)
ZConnection1: TZConnection;
ZQuery1: TZQuery;
Button1: TButton;
Edit1: TEdit;
Timer1: TTimer;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
public
end;
var
Form1 : TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
timer1.enabled := not timer1.enabled;
edit1.readonly := timer1.enabled;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
try
try
if not ZConnection1.Connected then
ZConnection1.Connect;
ZQuery1.SQL.text := edit1.text;
ZQuery1.Open;
ZQuery1.first;
if ZQuery1.Eof then
caption := 'empty'
else
caption := 'records';
except
on e: exception do
caption := e.message;
end
finally
ZQuery1.close;
end;
end;
end.