[Mono-list] ConstraintException after Dataset remove/add rows and Update

chris6789 chris6789 at pacbell.net
Tue Dec 28 15:30:52 EST 2010


The test case has been simplified to fail even on simple update of a non-key
field.

// Using the .xsd generation 
// 
//      DS is a typed Dataset containing a DataTable "parms" with an numeric
id column, autoinc off 
//      taParms is its TableAdapter
// 
xsd_genTableAdapter taParms = new xsd_genTableAdapter();

DS ds = new DS(); 

taParms.Fill(ds.parms);              // read some rows from db 

DS.parmsRow r = ds.parms[1];    // pick any row
r.some_field++;  // change any field, doesn't matter if it is a key or not

taParms.Update(ds.parms);             // write changes to db 

// Work-arounds:
//       Re-reading the parms table after update from the database
//       taParms.Update(ds.parms.Copy());

ds.EnforceConstraints = false;        // just toggle this 
ds.EnforceConstraints = true;         // ConstraintException thrown on mono
but not windows 

Anyone using xsd that could confirm/deny?

I believe the problem is that the DbDataAdapter::Update() is corrupting the
indexes.  The particular test case is using a 3-col PK if that makes any
difference.  Using Mono 2.8.1 windows and linux builds both fail.  Works
great on native non-mono windows.

Chris
-- 
View this message in context: http://mono.1490590.n4.nabble.com/ConstraintException-after-Dataset-remove-add-rows-and-Update-tp3090120p3166428.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list