W
wp231957
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Button1Click(Sender: TObject);
var
i,j:integer;
t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16:char;
t0:string;
label aa;
begin
Randomize;
if edit1.Text ='' then exit;
IF not(isnum(edit2.text)) then exit;
progressBar:=TProgressBar.Create(Form1);
//初始化进度条
with progressbar do begin
top:=progressbarrect.Top ;
left:=progressbarrect.Left ;
Width:=ProgressBarRect.Right-ProgressBarRect.Left;
Height:=ProgressBarRect.Bottom-ProgressBarRect.Top;
visible:=true;
Parent:=StatusBar1;
min:=0 ;
max:=STRTOINT(EDIT2.TEXT);
step:=1;
end;
adoquery1.ConnectionString:='provider=msdasql.1;persist info=true;data source=ms access database; Password=353535 ;initial catalog=base.mdb';
adoquery1.SQL.Text :='select * from '+edit1.Text ;
adoquery1.Open ;
for i:=1 to STRTOINT(EDIT2.TEXT) do begin
aa:
t1:=ss[random(35)]; //SS为取随机字符串的源
t2:=ss[random(35)];
t3:=ss[random(35)];
t4:=ss[random(35)];
t5:=ss[random(35)];
t6:=ss[random(35)];
t7:=ss[random(35)];
t8:=ss[random(35)];
t9:=ss[random(35)];
t10:=ss[random(35)];
t11:=ss[random(35)];
t12:=ss[random(35)];
t13:=ss[random(35)];
t14:=ss[random(35)];
t15:=ss[random(35)];
t16:=ss[random(35)];
//目的就是产生一个16位长的随机字符串
t0:=t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15+t16;
adoquery1.First ;
for j:=1 to adoquery1.RecordCount do begin
//如果有相等则退出重新来过
if adoquery1.FieldByName('point_name').AsString =t0 then goto aa;
adoquery1.Next ;
end;
//没有相等,则向数据库中添加
adoquery1.Append ;
adoquery1.FieldByName('point_name').AsString:=t0;
adoquery1.Post;
progressbar.StepIt ;
end;
end;
var
i,j:integer;
t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16:char;
t0:string;
label aa;
begin
Randomize;
if edit1.Text ='' then exit;
IF not(isnum(edit2.text)) then exit;
progressBar:=TProgressBar.Create(Form1);
//初始化进度条
with progressbar do begin
top:=progressbarrect.Top ;
left:=progressbarrect.Left ;
Width:=ProgressBarRect.Right-ProgressBarRect.Left;
Height:=ProgressBarRect.Bottom-ProgressBarRect.Top;
visible:=true;
Parent:=StatusBar1;
min:=0 ;
max:=STRTOINT(EDIT2.TEXT);
step:=1;
end;
adoquery1.ConnectionString:='provider=msdasql.1;persist info=true;data source=ms access database; Password=353535 ;initial catalog=base.mdb';
adoquery1.SQL.Text :='select * from '+edit1.Text ;
adoquery1.Open ;
for i:=1 to STRTOINT(EDIT2.TEXT) do begin
aa:
t1:=ss[random(35)]; //SS为取随机字符串的源
t2:=ss[random(35)];
t3:=ss[random(35)];
t4:=ss[random(35)];
t5:=ss[random(35)];
t6:=ss[random(35)];
t7:=ss[random(35)];
t8:=ss[random(35)];
t9:=ss[random(35)];
t10:=ss[random(35)];
t11:=ss[random(35)];
t12:=ss[random(35)];
t13:=ss[random(35)];
t14:=ss[random(35)];
t15:=ss[random(35)];
t16:=ss[random(35)];
//目的就是产生一个16位长的随机字符串
t0:=t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15+t16;
adoquery1.First ;
for j:=1 to adoquery1.RecordCount do begin
//如果有相等则退出重新来过
if adoquery1.FieldByName('point_name').AsString =t0 then goto aa;
adoquery1.Next ;
end;
//没有相等,则向数据库中添加
adoquery1.Append ;
adoquery1.FieldByName('point_name').AsString:=t0;
adoquery1.Post;
progressbar.StepIt ;
end;
end;