protected void Button2_Click(object sender, EventArgs e) { EMSEntities Context=new EMSEntities(); EntittyFramewordWebApplication4.StudentDetail stud1=new StudentDetail(); stud1.id = "67"; stud1.name = "ziauddin"; stud1.address = "chittagong"; stud1.marks = 88; stud1.section = "C"; Context.StudentDetails.Add(stud1); Context.SaveChanges(); Label1.Text = "added"; }
protected void Button2_Click(object sender, EventArgs e) { EMSEntities Context = new EMSEntities(); EntittyFramewordWebApplication4.StudentDetail stud1 = new StudentDetail(); stud1.id = "67"; stud1.name = "ziauddin"; stud1.address = "chittagong"; stud1.marks = 88; stud1.section = "C"; Context.StudentDetails.Add(stud1); Context.SaveChanges(); Label1.Text = "added"; }
protected void Button4_Click(object sender, EventArgs e) { EMSEntities dbcontext = new EMSEntities(); EntittyFramewordWebApplication4.StudentDetail stud1 = new StudentDetail(); try { string idd = TextBox2.Text; stud1 = dbcontext.StudentDetails.FirstOrDefault(xx => xx.id == idd); dbcontext.StudentDetails.Remove(stud1); dbcontext.SaveChanges(); Label1.Text = "delated successfull"; } catch (Exception e1) { Label1.Text = "not found"; } }
protected void Button3_Click(object sender, EventArgs e) { EMSEntities dbcontext = new EMSEntities(); EntittyFramewordWebApplication4.StudentDetail stud1 = new StudentDetail(); try { string idd = TextBox2.Text; stud1 = dbcontext.StudentDetails.FirstOrDefault(xx => xx.id == idd); stud1.marks = int.Parse(TextBox6.Text); stud1.section = TextBox5.Text; dbcontext.SaveChanges(); Label1.Text = "updated successfull"; } catch(Exception e1) { Label1.Text = "not found"; } }