TFDCustomMemTable.AppendData

来源:互联网 发布:音轨软件有哪些 编辑:程序博客网 时间:2024/05/01 22:56

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 theCopyDataSet 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是否过滤
都会复制
0 0
原创粉丝点击