I have a program written with Delphi 7 that has a simple procedure to zero out values in an ADO Table. There are 52 rows, one for each week of the year. When I try to run the procedure I get the following error message:
Key column information is insufficient or incorrect. Too many rows were effected by update.
Here is my code:
With ADOTable2 do
begin
active := true;
first;
edit; For I := 1 to 52 do
begin
FieldByName('Week').AsString := '';
FieldByName('DateName').AsString := '';
FieldByName('WeekName').AsString := '';
FieldByName('Collect').AsInteger := 0;
FieldByName('Visitor').AsInteger := 0;
FieldByName('Unresolved').AsString := '';
next;
end;
post;
end;
By stepping through the code I determined that I has a beginning value of 52 not 1. This seems to be the problem.
Why is the loop counter not counting correctly and how can I resolve this problem?
Key column information is insufficient or incorrect. Too many rows were effected by update.
Here is my code:
With ADOTable2 do
begin
active := true;
first;
edit; For I := 1 to 52 do
begin
FieldByName('Week').AsString := '';
FieldByName('DateName').AsString := '';
FieldByName('WeekName').AsString := '';
FieldByName('Collect').AsInteger := 0;
FieldByName('Visitor').AsInteger := 0;
FieldByName('Unresolved').AsString := '';
next;
end;
post;
end;
By stepping through the code I determined that I has a beginning value of 52 not 1. This seems to be the problem.
Why is the loop counter not counting correctly and how can I resolve this problem?