I’ve been using LINQ to SQL for some time, and each time I come back to the same example, so it’s about time I shared the example:
// Create a DataContext.
Northwind db = new Northwind();
// Retrieve customer LAZYK.
Customer cust = (from c in db.Customers
where c.CustomerID == “LAZYK”
// Update the contact name.
cust.ContactName = “John Smith”;
// Save the changes.
// Detect concurrency conflicts.
// Resolve conflicts.