Link to home
Start Free TrialLog in
Avatar of altric
altric

asked on

Insert record loop not shown on the grid

Good day, everyone.

I have a function to carry out that is trying to insert 100,000 record into a table.

So, I try to implement in the following way:
--------------------------------------------------------
procedure form1.Button1Click(Sender: TObject);
var runLength, runtime : longint;
begin
runLength := 100,000;
runtime := 1;

While runtime <= runLength do begin
tableX.Append;
tableXName.value := 'cust' + IntToStr(runtime);
runtime := runtime + 1;
tableX.post;
end;

tableX.close;
end;
---------------------------------------------------------

Why I couldn't see the record being inserted into the grid while the loop is running.

Thank you.
Avatar of kretzschmar
kretzschmar
Flag of Germany image

use application.processmessages within your loop

(will you really see it? -> costs performance)
ASKER CERTIFIED SOLUTION
Avatar of Dumani
Dumani

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of altric
altric

ASKER

A bit slow...anyway to speed it up?
you can change value:
(runtime mod 100)
change it
(runtime mod 1000)