void Delete() { data2 dt = db.data2.Where(p => p.mahieucongto == et_mact.Text).SingleOrDefault(); db.data2.Remove(dt); db.SaveChanges(); }
void Edit() { int id1 = Convert.ToInt32(datagridview2.SelectedCells[0].OwningRow.Cells["STT"].Value.ToString()); data2 dt = db.data2.Find(id1); dt.fullname = et_name.Text; dt.thon = et_thon.Text; dt.matram = et_tram.Text; dt.dong = et_ctdong.Text; dt.pha = et_ctpha.Text; dt.mahieucongto = et_mact.Text; dt.ngaykiemdinh = dt_dky.DateTime; dt.hankiemdinh = dt_hhan.DateTime; dt.ghichu = et_ghichu.Text; db.SaveChanges(); }
void Add() { { data2 dt = new data2() { fullname = et_name.Text, thon = et_thon.Text, matram = et_tram.Text, dong = et_ctdong.Text, pha = et_ctpha.Text, mahieucongto = et_mact.Text, ngaykiemdinh = dt_dky.DateTime, hankiemdinh = dt_hhan.DateTime, ghichu = et_ghichu.Text }; db.data2.Add(dt); db.SaveChanges(); } }