Thursday, August 18, 2011

Iterate Table

// uses DB

procedure TForm1.ToolButton1Click(Sender: TObject);
var
i: integer;
begin
with Table1 do
begin
  DisableControls;
  try
    First;
    while not Table1.EOF do
    begin
        // your code here, process record
      Next;
      Application.ProcessMessages;
    end;
  finally
    EnableControls;
  end;
end; // with Table1 do
end;

No comments: