3

Let said i have a ClientDataSet1 link with TDataSetProvider to access database for data and i have opened the ClientDataSet1 ready for edit and did some changes, so at the end i have some delta. The delta being assigned to TPacketDataSet for easy resolve purpose before i call ClientDataSet1.ApplyUpdates. Is there anyway to find out the current record of TPacketDataSet is actually point to which record in TClientDataSet without call TDataSet.Locate as i believe TDataSet.Locate might slow down performance. I would like to locate TClientDataSet record while traversing TPacketDataSet for some editing purpose. I have some reason not to do this in TDataSetProvider.OnUpdateData due to some problem i face earlier here.

procedure Test;
var P: TPacketDataSet;
begin
  P := TPacketDataSet.Create(nil);
  try
    P.Data := ClientDataSet1.Delta;
    P.First;
    while not P.Eof do begin
      if P.UpdateStatus = usUnmodified then begin
        P.InitAltRecBuffers(True); 
        //How to know the current record in P point to which record in ClientDataSet1
      end;
      P.Next;
    end; 
  finally
    P.Free;
 end;
end;

Thanks!

4

1 回答 1

0

如果您在原始 TClientDataset 中有索引,则可以使用 FindKey。但我不相信 Locate 会是个大问题。

于 2011-07-07T20:25:48.723 回答