USEGEAR

导航

FDMemtable如何增加一条自身复制的记录

procedure TFrame_Bill.CopyARecord;
var
  lAFDmemtable : TFDMemTable;
begin
{$REGION '增加一条复制的记录'}
  try
    lAFDmemtable := TFDMemTable.Create(nil);
    lAFDmemtable.CopyDataSet(fdmtbl_Detail,[coStructure]);//copy 结构
    lAFDmemtable.Append;
    lAFDmemtable.CopyRecord(fdmtbl_Detail);
    lAFDmemtable.fieldbyName('CTD_Key').Value := IdGenerator.NextId().ToString;
    fdmtbl_Detail.CopyDataSet(lAFDmemtable,[coAppend]);//增加一条记录
  finally
    lAFDmemtable.FreeOnRelease;
  end;
  changeStateImage;
{$ENDREGION}
 end;

 

posted on 2022-04-16 15:54  USEGEAR  阅读(182)  评论(0编辑  收藏  举报