Failing to update

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Idea

Failing to update

Post by Idea » Tue 31 May 2005 15:28

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?

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 01 Jun 2005 06:28

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.

Idea

Post by Idea » Tue 07 Jun 2005 12:21

Thanks,
setting an unique key and this problem gone.

Post Reply