// Read through all records in a table and updates// the ProgressBar accordingly.procedure TForm1.Button1Click(Sender: TObject);var i: Integer; begin with ProgressBar1 do begin Min := 0; Max := SQLDataSet1.RecordCount; SQLDataSet1.First; for i := Min to Max do begin Position := i; SQLDataSet1.Next; // do something with the current record end; end; end;
很简单,你就用ProgressBar1.value属性控制就行了
query1.sql.clear; query1.sql.add('select * from xxx'); query1.close; query1.open; query1.first; progressbar1.max:=query1.recordcount; progressbar1.position:=0; while not query1.eof do begin progressbar1.stepby(1); query1.next; end;
i: Integer;
begin
with ProgressBar1 do
begin
Min := 0;
Max := SQLDataSet1.RecordCount;
SQLDataSet1.First;
for i := Min to Max do
begin
Position := i;
SQLDataSet1.Next;
// do something with the current record
end;
end;
end;
query1.sql.add('select * from xxx');
query1.close;
query1.open;
query1.first;
progressbar1.max:=query1.recordcount;
progressbar1.position:=0;
while not query1.eof do begin
progressbar1.stepby(1);
query1.next;
end;