SubmitChanges() Not Persisting
Posted: Tue 31 Jan 2012 18:35
I am new to this tool but after following the tutorial I am unable to get a simple update to save to an Oracle database using the following code:
RTPCRDataContext db = GetDb();
// update the comments for one record
RTPCR_DAT myUpdate = db.RTPCR_DATs.First(d => d.EU_ID == 180326520);
myUpdate.COMMENTS = "Updated comments...";
db.SubmitChanges(System.Data.Linq.ConflictMode.FailOnFirstConflict);
// get the updated information from the database
RTPCR_DAT myRead = db.RTPCR_DATs.Single(d => d.EU_ID == 180326520);
Response.Write(" updated comment = " + myRead.COMMENTS);
I can make changes directly to the database using Toad and I have tried several different fields and several different records but the changes are not being persisted. I have also tried it in a transaction, with and without the "System.Data.Linq.ConflictMode.FailOnFirstConflict" and have tried setting the Update Check properties on that field as Always, Never and WhenChanged. I'm prepared for this to be a really simple (DUH!) oversight on my part so could someone please point out what I'm missing?
Thank you!
RTPCRDataContext db = GetDb();
// update the comments for one record
RTPCR_DAT myUpdate = db.RTPCR_DATs.First(d => d.EU_ID == 180326520);
myUpdate.COMMENTS = "Updated comments...";
db.SubmitChanges(System.Data.Linq.ConflictMode.FailOnFirstConflict);
// get the updated information from the database
RTPCR_DAT myRead = db.RTPCR_DATs.Single(d => d.EU_ID == 180326520);
Response.Write(" updated comment = " + myRead.COMMENTS);
I can make changes directly to the database using Toad and I have tried several different fields and several different records but the changes are not being persisted. I have also tried it in a transaction, with and without the "System.Data.Linq.ConflictMode.FailOnFirstConflict" and have tried setting the Update Check properties on that field as Always, Never and WhenChanged. I'm prepared for this to be a really simple (DUH!) oversight on my part so could someone please point out what I'm missing?
Thank you!