jswqg,
zhumoo:
就是Table,Table1是从表,Table2是主表,两表以 职工编号 进行关联
if not Table2.Active then
Table2.open;
Table2.First ;
if Table1.Active then
Table1.Close;
Table1.open;
while not Table2.eof do
begin
if Table1.RecordCount >0 then
begin
Table1.First ;
i:=0;
s:=Table2.fieldbyname('职工编号').asstring;
while not table1.Eof do
begin
i:=i+1;
case length(inttostr(i)) of
1: s1:=s+'00'+inttostr(i);
2: s1:=s+'0'+inttostr(i);
3: s1:=s+inttostr(i);
end;
Table1.edit;
Table1.FieldByName ('id').asstring:=s1;
Table1.Post ;
Table1.Next ;
end;
end;
Table2.next;
end;