数据集ClientDataset1,ClientDataset2选取的数据结构一致,请问如何将数据集2的数据加入到数据集1呢?不能是将数据集ClientDataset2一个一个的Append的!TClientDatase或TDataSet里有没有符合此要求的方法你呢?

解决方案 »

  1.   

    procedure Clone(Source: TCustomADODataSet; LockType: TLockType = ltUnspecified);DescriptionCall Clone to make the recordset of the calling ADO dataset component a duplicate of the recordset active in another TCustomADODataSet descendant component. If the attempt to clone a recordset is successful, the current ADO dataset component抯 recordset will be the same as that in the other dataset. If unsuccessful, the recordset is set to nil and an EADOError exception raised.example:
    ADOQuery2.Clone(ADOQuery1,[])
      

  2.   

    ClientDataset2:
    select * into (另一个数据库)临时表 from 你的一个数据库的表create view tmp as
    select * from 临时表
    union
    select * from 原来的另一个表 ClientDataset1:
    select * from tmp
      

  3.   

    这个方法我也不清晰:数据集好像可以同Tstringlist互导,如果数据量不是很大应该可以,还是2合1,然后再导出来
      

  4.   

    用TClientDataSet的AppendData, procedure AppendData(const Data: OleVariant; HitEOF: Boolean);var
      cds: TClientDataSet;
    begin
      cds.appenddata(clientdataset1, true);
      cds.appenddata(clientdataset2, true);
    end;
      

  5.   

    也可以直接clientdataset1.appenddata(clientdataset2,true)