Running .net 2008, asp.net, Linq to sql, sql server 2008 express
Foo f = db.Foo.First(x => x.ID == id);
f.IsValid = true;
db.SubmitChanges();
I have a very basic table, which has several fields, and no FK constraints. None of the data saves when I call .SubmitChanges(), but no error is thrown. Any ideas?
Not using any explicit transaction scope, fields are not autogenerated, and no triggers on the server.
Tyop aside, the first thing to try is setting db.Log = Console.Out; to see if any TSQL is issues (or better: run a SQL trace). If nothing is getting sent then maybe IsValid was already true - it won't re-save such changes unless it has to (unless you force it).
Less likely, you could perhaps have accidentally turning off object-tracking (db.ObjectTrackingEnabled).
Other common mistakes include:
Complete() when using TransactionScope (if you are using TransactionScope)I'm also assuming that IsValid is actually a db-mapped property (they don't have to be)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With