update failed error updates records????

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
GuzunNicolae
Posts: 78
Joined: Wed 17 Jan 2007 14:16

update failed error updates records????

Post by GuzunNicolae » Thu 06 Sep 2007 16:31

Hello

When I do Edit, Post and there are more than 1 matching records I get Update Failed: xx records found exception. Which is correct.

But as I've noticed it still does the update. It still updates that xx records. What I think is not correct. And I did not notice this earlier.

Tell me what to do to show you.

Thanks.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 07 Sep 2007 10:51

MyDAC cannot determine how many records will be modified before an update query has been performed. After an update command has been performed, MyDAC gets from the server count of the affected rows, and, if the value differs from one, raises an exception. To avoid this problem, you should wrap delete and update operations in transactions.

GuzunNicolae
Posts: 78
Joined: Wed 17 Jan 2007 14:16

Post by GuzunNicolae » Fri 07 Sep 2007 14:45

I guess this does not matter if this is a TMyTable or TMyQuery component?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 07 Sep 2007 15:15

TMyTable is just a wrapper on TMyQuery, so there is no difference in this case.

GuzunNicolae
Posts: 78
Joined: Wed 17 Jan 2007 14:16

Post by GuzunNicolae » Fri 07 Sep 2007 16:15

I see.
Not a good news, but thanks anyway :)

Post Reply