1、 需要2个ClientDataSet组件;
2、 clientDataSet1连接目标表,clientDataSet2连接源表,如果无法直接连接,使用DataSetProvider进行桥接;
3、 复制clientDataSet2结构到clientDataSet1; for I := 0 to clientDataSet2.FieldDefs.Count-1 do fieldNames:=fieldNames+clientDataSet2.FieldDefs[i].Name+';'; list:=Tlist.Create; clientdataset2.GetFieldList(list,fieldNames); for I := 0 to list.count-1 do begin field:=list[i]; clientDataSet1.FieldDefs.Add(field.fullName,field.DataType,field.Size); end; clientdataset1.CreateDataSet; 4、 复制clientDataSet2数据到clientDataSet1。 clientdataset1.Data:=clientdataset2.Data; |