TFDCustomMemTable.AppendData

procedure AppendData(const AData: IFDDataSetReference; AHitEOF: Boolean = True);

Appends data to this dataset from other datasets.

Use the AppendData method to append the rows from one FireDAC dataset to this dataset. The property is a shortcut for theData property and the CopyDataSet method. 

If this dataset is inactive, then it inherits the structure from AData, gets activated and rows are appended. When this dataset is active, then rows are imported and only compatible fields are filled. 

The property is for the TClientDataSet compatibility.


如果当前内存数据集不是活动的,则复制AData 的结构及记录,如果是活动的,则只复制与AData相同记录数的同名字段数据
eg.
FDMemTable1.Close ;
FDQuery1.Connection := FDConnection1;
FDQuery1.Open('select A1, A2 from TB');
FDMemTable1.AppendData(FDQuery1);  -- 执行后 FDMemTable1与 FDQuery1 的记录与字段结构一致
 
FDQuery2.Connection := FDConnection2;
FDQuery2.Open('select A1, A2, A3 from TB');
FDMemTable1.AppendData(FDQuery2);  -- 执行后 FDMemTable1只会将 FDQuery2字段A1, A2的数据复制过来

FDQuery3.Connection := FDConnection2;
FDQuery3.Open('select A4 from TB');
FDMemTable1.AppendData(FDQuery3);  -- 执行后 FDMemTable1只会产生与 FDQuery3相同记录数的数据, 原有 A1, A2是空的
注:
FDMemTable1.AppendData(FDQuery3) 与 FDMemTable1.AppendData(FDQuery3.Data)有差异
FDMemTable1.AppendData(FDQuery3): 如果FDQuery3有过滤,则只Append过滤后的数据, 如果使用FDQuery3.Data,则无论FDQuery3是否过滤
都会复制
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值