[Mono-list] ConstraintException after Dataset remove/add rows and Update
chris6789
chris6789 at pacbell.net
Wed Dec 15 18:47:04 EST 2010
Hi,
I have some code using the generated typesafe DataSet and TableAdapters that
runs fine on windows but not within Mono. Has anyone run into this or can
anyone verify this is a bug? Mono version 2.6.7
Thanks,
Chris
// Using the .xsd generation
//
// DS is a typed Dataset containing a DataTable "parms" with an numeric
id column, autoinc off
// taParms is its table adapter
//
DS ds = new DS();
taParms.Fill(ds.parms); // read from db
DS.parmsRow r = ds.parms[1];
ds.parms.RemoveparmsRow(r); // removes row without updating db
r = ds.parms.NewparmsRow();
r.id = <new id that does not conflict>; // set row vals
ds.parms.AddparmsRow(r);
taParms.Update(ds.parms); // write changes to db
// Adding parms.Acceptchanges() did not help here
// Re-reading the parms table from the database works around the problem
here
ds.EnforceConstraints = false; // just toggle this
ds.EnforceConstraints = true; // ConstraintException thrown on mono
but not windows
--
View this message in context: http://mono.1490590.n4.nabble.com/ConstraintException-after-Dataset-remove-add-rows-and-Update-tp3090120p3090120.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list