使用ClientDataSet.CloneCursor

总结:
1. 使用CloneCursor(FSourceCds, false), 新的Cds移动(first, next, piror, last)不会影响到FSourceCds的移动.

  pvParentKey:=FCdsGongChengPZJL_TV.FieldByName('FKey').AsString;
    lvTmpCds := TClientDataSet.Create(nil);
    lvTmpCds.CloneCursor(FCdsGongChengPZJL_TV, false);
    lvTmpCds.First;
    raise Exception.Create(
          'Clone:' + lvTmpCds.FieldByName('FKey').AsString
          + sLineBreak + 'After Clone:' + FCdsGongChengPZJL_TV.FieldByName('FKey').AsString
          + sLineBreak + 'Before Clone:' + pvParentKey

image

raise Exception.Create(
      'Clone Filter[' + lvTmpCds.Filter + '] RecordCount:' + IntToStr(lvTmpCds.RecordCount)
      + sLineBreak + 'Source Filter[' + FCdsGongChengPZJL_TV.Filter + '] RecordCount:' + IntToStr(FCdsGongChengPZJL_TV.RecordCount)
      );

image

原文地址:https://www.cnblogs.com/DKSoft/p/1269281.html