On Wed, 18 Oct 2006 16:57:53 +0200, Robert Jordan <[EMAIL PROTECTED]>
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

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to