private void button2_Click(object sender, EventArgs e) { int dongchon = dataGridView1.CurrentCell.RowIndex; QLNvDBDataContext db = new QLNvDBDataContext(); DONVI q = db.DONVIs.Single(p => Convert.ToString(p.MADONVI) == dataGridView1.Rows[dongchon].Cells["MADONVI"].Value.ToString()); db.DONVIs.DeleteOnSubmit(q); db.SubmitChanges(); load(); }
private void button6_Click(object sender, EventArgs e) { int dongchon = dataGridView1.CurrentCell.RowIndex; QLNvDBDataContext db = new QLNvDBDataContext(); DONVI q = db.DONVIs.Single(p => Convert.ToString(p.MADONVI) == dataGridView1.Rows[dongchon].Cells["MADONVI"].Value.ToString()); q.MADONVI = Convert.ToInt32(textBox1.Text); q.TENDONVI = textBox2.Text; q.DIENTHOAI = textBox4.Text; db.SubmitChanges(); load(); }
private void button1_Click(object sender, EventArgs e) { QLNvDBDataContext db = new QLNvDBDataContext(); DONVI dv = new DONVI(); dv.MADONVI = Convert.ToInt32(textBox1.Text); dv.TENDONVI = textBox2.Text; dv.DIENTHOAI = textBox4.Text; db.DONVIs.InsertOnSubmit(dv); db.SubmitChanges(); load(); }