private void button2_Click(object sender, EventArgs e) { DBDataContext DB = new DBDataContext(); AB w = new AB(); w.Book_Id = textBox2.Text; w.Book_Name = textBox1.Text; w.Quantity = textBox3.Text; DB.ABs.InsertOnSubmit(w); DB.SubmitChanges(); MessageBox.Show("Book Added!!"); }
private void button2_Click(object sender, EventArgs e) { DBDataContext DB = new DBDataContext(); string id = textBox2.Text; AB s = DB.ABs.SingleOrDefault(x => x.Book_Id == id); if (s != null) { s.Book_Id = textBox2.Text; s.Book_Name = textBox1.Text; s.Quantity = textBox3.Text; DB.SubmitChanges(); MessageBox.Show("Information Updated!!"); } }
private void button3_Click(object sender, EventArgs e) { DBDataContext DB = new DBDataContext(); string id = textBox2.Text; AB s = DB.ABs.SingleOrDefault(x => x.Book_Id == id); if (s != null) { textBox1.Text = s.Book_Name; textBox3.Text = s.Quantity; } else { MessageBox.Show("Data not found"); } }
partial void DeleteAB(AB instance);
partial void UpdateAB(AB instance);
partial void InsertAB(AB instance);