var i:integer; begin adotable1.Edit; adotable1.Last; adotable1.Insert; for i:=0 to DBGrid1.FieldCount-1 do begin if adotable1.Fields[i].DataType = ftstring then adotable1.Fields[i].AsString:=''; if adotable1.Fields[i].DataType = ftdatetime then adotable1.Fields[i].Value:=date(); if adotable1.Fields[i].DataType = ftinteger then adotable1.Fields[i].Value:=0; if adotable1.Fields[i].DataType = ftfloat then adotable1.Fields[i].Value:=0; if adotable1.Fields[i].DataType = ftboolean then adotable1.Fields[i].Value:=true; end; adotable1.Post; adotable1.Refresh; //刷新记录 DBGrid1.Refresh; refresh; DBGrid1.SetFocus;
i:integer;
begin
adotable1.Edit;
adotable1.Last;
adotable1.Insert;
for i:=0 to DBGrid1.FieldCount-1 do
begin
if adotable1.Fields[i].DataType = ftstring then adotable1.Fields[i].AsString:='';
if adotable1.Fields[i].DataType = ftdatetime then adotable1.Fields[i].Value:=date();
if adotable1.Fields[i].DataType = ftinteger then adotable1.Fields[i].Value:=0;
if adotable1.Fields[i].DataType = ftfloat then adotable1.Fields[i].Value:=0;
if adotable1.Fields[i].DataType = ftboolean then adotable1.Fields[i].Value:=true;
end;
adotable1.Post;
adotable1.Refresh; //刷新记录
DBGrid1.Refresh;
refresh;
DBGrid1.SetFocus;