示例#1
0
 protected void Updatebtn_Click(object sender, EventArgs e)
 {
     using (DataClassDataContext db = new DataClassDataContext())
     {
         foreach (SUPPLIER x in db.SUPPLIERs)
         {
             x.Status = x.Status * 1.1;
             db.SubmitChanges();
         }
     }
 }
示例#2
0
        protected void Insert2_btn_Click(object sender, EventArgs e)
        {
            using (DataClassDataContext db = new DataClassDataContext())
            {
                SHIPMENT newShipment = new SHIPMENT
                {
                    Sno   = "s4",
                    Pno   = "p2",
                    Qty   = 100,
                    Price = .005
                };

                try
                {
                    db.SHIPMENTs.InsertOnSubmit(newShipment);
                    db.SubmitChanges();
                    Response.Write("<script>alert('Success') </script>");
                }
                catch
                {
                    Response.Write("<script>alert('Fail') </script>");
                }
            }
        }