procedure mythread.Execute;
var j,f,g,h,u:integer;
listcolumn:tlistcolumn;
listitem:tlistitem;
begin
mylistview.viewstyle:=vsreport;
mylistview.GridLines :=true;
h:=strtoint(myedit.text);
mypbr.Min :=0;
mypbr.Max :=h-1;
for i:=0 to h-1 do
begin
j:=random(200000);
f:=random(1000);
g:=random(3000);
myquery1.close;
myquery1.sql.clear;
myquery1.sql.add('select * from testcontrol');
myquery1.open;
for u:=0 to myquery1.recordcount-1 do
begin
myquery2.sql.clear;
myquery2.sql.add('select * from testcontrol');
myquery2.sql.add('where numb1=:number');
myquery2.parambyname('number').asinteger:=j;
myquery2.open;
end;
if myquery2.isempty then
begin
myquery1.sql.clear;
myquery1.sql.add('insert into testcontrol(numb1,numb2,numb3)');
myquery1.sql.add('values(:numb1,:numb2,:numb3)');
myquery1.parambyname('numb1').asinteger:=j;
myquery1.parambyname('numb2').asinteger:=f;
myquery1.parambyname('numb3').asinteger:=g;
myquery1.ExecSQL ;
mylabel.caption:='现在正在生成第'+inttostr(i+1)+'条记录';
if (i=h-1) then
begin
mylabel.caption:='记录生成完毕,共计'+inttostr(i+1)+'条';
end;
mypbr.position:=i;
if (gi=1) then //gi是个全局变量
suspended:=true;
if (gi=0) then
suspended:=false;
listitem:=mylistview.Items.add;
listitem.caption:=inttostr(j);
listitem. SubItems .add(inttostr(f));
listitem. subitems. add(inttostr(g));
end
else
begin
end;
end;
with myquery1.sql do
begin
clear;
add('select * from testcontrol');
end;
myquery1.open;
procedure mythread.Execute;
var j,f,g,h,u:integer;
listcolumn:tlistcolumn;
listitem:tlistitem;
begin
mylistview.viewstyle:=vsreport;
mylistview.GridLines :=true;
h:=strtoint(myedit.text);
mypbr.Min :=0;
mypbr.Max :=h-1;
for i:=0 to h-1 do
begin
j:=random(200000);
f:=random(1000);
g:=random(3000);
myquery1.close;
myquery1.sql.clear;
myquery1.sql.add('select * from testcontrol');
myquery1.open;
for u:=0 to myquery1.recordcount-1 do
begin
myquery2.sql.clear;
myquery2.sql.add('select * from testcontrol');
myquery2.sql.add('where numb1=:number');
myquery2.parambyname('number').asinteger:=j;
myquery2.open;
end;
if myquery2.isempty then
begin
myquery1.sql.clear;
myquery1.sql.add('insert into testcontrol(numb1,numb2,numb3)');
myquery1.sql.add('values(:numb1,:numb2,:numb3)');
myquery1.parambyname('numb1').asinteger:=j;
myquery1.parambyname('numb2').asinteger:=f;
myquery1.parambyname('numb3').asinteger:=g;
myquery1.ExecSQL ;
mylabel.caption:='现在正在生成第'+inttostr(i+1)+'条记录';
if (i=h-1) then
begin
mylabel.caption:='记录生成完毕,共计'+inttostr(i+1)+'条';
end;
mypbr.position:=i;
if (gi=1) then //gi是个全局变量
suspended:=true;
if (gi=0) then
suspended:=false;
listitem:=mylistview.Items.add;
listitem.caption:=inttostr(j);
listitem. SubItems .add(inttostr(f));
listitem. subitems. add(inttostr(g));
end
else
begin
end;
end;
with myquery1.sql do
begin
clear;
add('select * from testcontrol');
end;
myquery1.open;