示例#1
0
 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();
 }
示例#2
0
        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();
        }
示例#3
0
        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();
        }