是在姓名后面直接加编号还是重新建一个字段进行编号? 建议: 重新建一个字段,专门作为每个人的编号。要直接加的话,我没试过: var I:Integer; str1,str2:string; begin for I:=0 to DBGrid1.FieldCount-1 to begin Str1:=ADODataSet1.FieldByName('xingming').AsString; Str2:=Str1+'I'; ADODataSet1.FieldByName('xingming').AsString:=Str2; AdodataSEt1.Active :=false; AdodataSEt1.Active :=true; end;end;
建议:
重新建一个字段,专门作为每个人的编号。要直接加的话,我没试过:
var
I:Integer;
str1,str2:string;
begin
for I:=0 to DBGrid1.FieldCount-1 to
begin
Str1:=ADODataSet1.FieldByName('xingming').AsString; Str2:=Str1+'I';
ADODataSet1.FieldByName('xingming').AsString:=Str2;
AdodataSEt1.Active :=false;
AdodataSEt1.Active :=true;
end;end;