How to find out current delta record in TPacketDataSet point to which record in TClientDataSet?
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.Locat开发者_如何学JAVAe 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!
If you have an index in origin TClientDataset, you could use FindKey. But I don't believe that Locate would be much of a problem.
精彩评论