D6: TClientDataSet.Next

D6: TClientDataSet.Next

Post by jodlere » Sun, 29 Mar 2009 02:17:27


I already wrote about that, but here it is.

I am updating a programme in D6, where TClientDataSet.Next acts
wierd... it worked before I got it.

There are a number records (test: 37), and when reaching the .Next
then .RecNo jumps from 1 to 37 and EOF becomes true. MoveBy does the
same.

Any ideas why?
I just installed service pack 1 & 2.

Code

with DBModule.PDataSet do
begin
DisableControls;

First;
while not Eof do
begin
Code := FieldByName('something').AsString;
Ver := FieldByName('something else').AsString;
for i := 0 to Length(PartList) - 1 do
begin
if (not PartList[i].DB) and (Code = PartList[i].Code) and
(Ver = PartList[i].Ver) and (PartList[i].Ft = 'P') then
begin
Edit;
FieldByName('whatever').AsInteger := strtoint(PartList
[i].Qty);
FieldByName('whatever').AsInteger := PartList[i].Pos;
PartList[i].DB := True;
FieldByName('whatever').AsString := '';
end;
end;
Next; // here it jumps to the last setting EOF=true.
// MoveBy(1); // same
end;
 
 
 

D6: TClientDataSet.Next

Post by postman195 » Sun, 29 Mar 2009 05:55:51

My best guess is that you are shooting yourself in the foot with
either a set filter or an active index - updating field(s) involved in
either may make you move....

Cheers
Kai