Page 1 of 1

Failing to update

Posted: Tue 31 May 2005 15:28
by Idea
Using Delpi 7 professional and you component :

I traing to update a file into a table of 462289 row using this code:

##############################################

procedure TForm2.Button2Click(Sender: TObject);
var
numero: integer;
begin
numero:=0;
mytable1.First;
while MyTable1.Eof = false do
begin
numero := numero+1;
MyTable1.Edit;
MyTable1.FieldByName('codice').AsInteger := numero;
MyTable1.Post;
MyTable1.Next;
end;
end;

###############################################

I receive the following error:
EdatabaseError whit message "update failed. found 4 records"

Il re-number the first 3 rows but no more!
Coult you tell me whot happen?

Posted: Wed 01 Jun 2005 06:28
by Ikar
This error message raises when on executing, for example, UPDATE statement several rows in the table were modified at the server. In most cases such situations happen if in the modified table there is no unique key field. Also you can turn off this message. Please refer to help TCustomMyDataSet.Options.StrictUpdate for details.

Posted: Tue 07 Jun 2005 12:21
by Idea
Thanks,
setting an unique key and this problem gone.