EPUB | CHM | PDF

Example: SetRange, CancelRange, Refresh

Top Previous Next

The following example sets a range for a table. The form requires two edit boxes, a data source, a table, a dbgrid, and a button.

procedure TForm1.FormActivate(Sender: TObject);
begin
  PSQLTable1.TableName := 'Customer';
  PSQLTable1.Active    := True;
  PSQLTable1.IndexName := 'ByCompany';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  if Button1.Caption = '&Apply Range' then
    begin
      PSQLTable1.SetRange([Edit1.Text],[Edit2.Text]);
      Button1.Caption := '&Drop Range';
    end
  else
    begin
      PSQLTable1.CancelRange;
      PSQLTable1.Refresh;
      Button1.Caption := '&Apply Range';
    end;
end;