//Method implemented on direct button click protected void DelBut_Click(object sender, EventArgs e) { using (LinqClassDataContext delete = new LinqClassDataContext()) { ProTab1 delvalue = delete.ProTab1s.SingleOrDefault(value => value.LName == "lorry"); delete.ProTab1s.DeleteOnSubmit(delvalue); delete.SubmitChanges(); GetData(); } }
//Method storage area //Method to update the table private void UpdateMethod() { using (LinqClassDataContext update = new LinqClassDataContext()) { ProTab1 insMet = update.ProTab1s.SingleOrDefault(value => value.LName == UpdOldLName.Text); insMet.LName = UpdNewLName.Text.ToString(); update.SubmitChanges(); GetData(); } }
//Method contains Code for insertion private void InsertData() { using (LinqClassDataContext context = new LinqClassDataContext()) { ProTab1 instab = new ProTab1 { Name = TextBox1.Text.ToString(), LName = TextBox2.Text.ToString() }; context.ProTab1s.InsertOnSubmit(instab); context.SubmitChanges(); GetData(); } }
partial void DeleteProTab1(ProTab1 instance);
partial void UpdateProTab1(ProTab1 instance);
partial void InsertProTab1(ProTab1 instance);