Here is a code first example:
LinqToSql code-first | LinqToSql Tutorial and Documentation[
^]
Microsoft simple examples:
What You Can Do With LINQ to SQL - ADO.NET | Microsoft Docs[
^]
And here is a more elaborate CodeProject tutorial, see the part about the
DataContext object:
LINQ to SQL: Basic Concepts and Features[
^]
and the examples about updating / inserting records:
Product bev1 = beverages.ElementAtOrDefault(10);
if (bev1 != null)
{
Console.WriteLine("The price of {0} is {1}. Update to 20.0",
bev1.ProductName, bev1.UnitPrice);
bev1.UnitPrice = (decimal)20.00;
}
db.SubmitChanges();
Product newProduct = new Product {ProductName="new test product" };
db.Products.InsertOnSubmit(newProduct);
db.SubmitChanges();