[Mono-dev] A bug in the latest SVN System.Data (concurrency exception)?

Marek Habersack grendel at caudium.net
Wed Oct 18 17:00:09 EDT 2006


On Wed, 18 Oct 2006 16:57:53 +0200, Robert Jordan <robertj at gmx.net>
scribbled:

[snip]
> > System.Data.DBConcurrencyException: Concurrency violation: the
> > UpdateCommand affected 0 records. at
> > System.Data.Common.DbDataAdapter.Update (System.Data.DataRow[]
> > dataRows, System.Data.Common.DataTableMapping tableMapping)
> > [0x00429]
> > in /usr/src/tmp/mono/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs:1059 
> > 
> > And there is at least one row that needs updating, that's for sure.
> > Can anyone confirm that?
> 
> It works for me under the 1.1 profile. I get the exception
> only when I'm trying to update the tables of an unmodified DataSet,
> i.e. dataSet.GetChanges () == null.
It seems the problem lies in the way Mono translates
a DateTime object created like:

DateTime dt = new DateTime(0);

which yields, for the MySql connector the following string:

0001-01-01 00:00:00

and I have a field in the database of the date type set to 0,
which for MySql renders the string:

0000-00-00 00:00:00

Now, the command builder builds a command that first sets all the
fields and then uses them all in the WHERE clause with the original
values - this is the way Mono detects the concurrency problem.
Obviously, there is no match for the above datetime field and the
entire transaction "fails" - that is, no rows are affected and the
exception is thrown. Not sure how to solve it though :)

best regards,

marek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061018/92f5e0cd/attachment.bin 


More information about the Mono-devel-list mailing list