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
  MySQLTable1.TableName := 'Customer';
  MySQLTable1.Active    := True;
  MySQLTable1.IndexName := 'ByCompany';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
  if Button1.Caption = '&Apply Range' then
    begin
      MySQLTable1.SetRange([Edit1.Text],[Edit2.Text]);
      Button1.Caption := '&Drop Range';
    end
  else
    begin
      MySQLTable1.CancelRange;
      MySQLTable1.Refresh;
      Button1.Caption := '&Apply Range';
    end;
end;