unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, dbisamtb, StdCtrls; type TForm1 = class(TForm) Button1: TButton; DBISAMQuery1: TDBISAMQuery; DataSource1: TDataSource; Button2: TButton; Label1: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin DBISAMQuery1.SQL.Clear; DBISAMQuery1.SQL.Add('insert into dppt (CorrectCode) values (FALSE);'); DBISAMQuery1.SQL.Add('delete from dppt where datetime < current_timestamp-900000;'); DBISAMQuery1.SQL.Add('select * from dppt;'); DBISAMQuery1.ExecSQL; if(DBISAMQuery1.RecordCount>5) then begin Label1.Caption:='PT: '+IntToStr(DBISAMQuery1.RecordCount); end else begin Label1.Caption:='Try: '+IntToStr(DBISAMQuery1.RecordCount); end; end; procedure TForm1.Button2Click(Sender: TObject); begin DBISAMQuery1.SQL.Clear; DBISAMQuery1.SQL.Add('select * from dppt;'); DBISAMQuery1.ExecSQL; if(DBISAMQuery1.RecordCount>5) then begin Label1.Caption:='PT: '+IntToStr(DBISAMQuery1.RecordCount); DBISAMQuery1.SQL.Clear; DBISAMQuery1.SQL.Add('delete from dppt where datetime < current_timestamp-900000;'); DBISAMQuery1.ExecSQL; end else begin Label1.Caption:='CC: '+IntToStr(DBISAMQuery1.RecordCount); DBISAMQuery1.SQL.Clear; DBISAMQuery1.SQL.Add('delete from dppt where datetime < current_timestamp;'); DBISAMQuery1.ExecSQL; end; end; end.