Delphi ClientDataSet复制记录

时间:2023-12-06 09:48:20

数据源记录集:ClientDataSetSource;目标记录集:ClientDataSetCopy

1)复制一条记录。

ClientDataSetCopy.Close;
  ClientDataSetCopy.Fields.Clear;
  ClientDataSetCopy.FieldDefs.Clear;

//复制字段定义
  ClientDataSetCopy.FieldDefs.Assign( ClientDataSetSource.FieldDefs);
  ClientDataSetCopy.CreateDataSet;
  ClientDataSetCopy.Edit; //Append;

//复制当前记录行
  ClientDataSetCopy.CopyFields(cds1);

2)复制所有记录。

ClientDataSetCopy.Close;
  ClientDataSetCopy.Fields.Clear;
  ClientDataSetCopy.AppendData(ClientDataSetSource.Data,False);
---------------------
作者:三界
来源:CSDN
原文:https://blog.csdn.net/qq56430204/article/details/50341421
版权声明:本文为博主原创文章,转载请附上博文链接!