FDMemTable 提示操作速度尤其是循环

 
复制代码
with FDMemTable1 do
begin
DisableControls; //切断数据感知控件
try
Open; //打开
//定义Field
fld_Id := TIntegerField(FieldByName('Id'));
fld_Value := TStringField(FieldByName('Value'));
fld_Time := TDateTimeField(FieldByName('Time'));
for i := 0 to 9 do
begin
Inc(Id);
Append; //附加数据
//赋值
fld_Id.AsInteger := Id;
fld_Value.AsString := 'Hello PFeng!' + inttostr(Id);
fld_Time.AsDateTime := Now;
Post; //确定
end;
//UpdateIndexes;//更新索引
finally
EnableControls; //连接数据感知控件
end;
end;
复制代码