protected void Delete_Click(object sender, EventArgs e) { NorthwindDataContext db = new NorthwindDataContext(); Product product = db.Products.Single(p => p.ProductName.StartsWith("Scott's")); db.Products.DeleteOnSubmit(product); db.SubmitChanges(); ShowProducts(); }
protected void Update_Click(object sender, EventArgs e) { NorthwindDataContext db = new NorthwindDataContext(); Product product = db.Products.First(p => p.ProductName.StartsWith("Scott's")); product.UnitPrice += 2.25m; db.SubmitChanges(); ShowProducts(); }
protected void Insert_Click(object sender, EventArgs e) { NorthwindDataContext db = new NorthwindDataContext(); Product p1 = new Product { CategoryID = 1, ProductName = "Scott's Apple Juice", UnitPrice = 4.23m }; db.Products.InsertOnSubmit(p1); db.SubmitChanges(); ShowProducts(); }