Update through Linq-to-SQL DataContext not working.
- by Puneet Dudeja
I have created a small test for updating table using Linq-to-SQL DataContext as follows:
using (pessimistic_exampleDataContext db = new pessimistic_exampleDataContext())
{
var query = db.test1s.First(t => t.a == 3);
if (query.b == "a")
query.b = "b";
else
query.b = "a";
db.SubmitChanges();
}
But after executing this code in a console application in Main method, when I select records from the table, the record is not updated.
I have debugged through the code, and it is not even throwing any exception.
What can be the problem ?