private void Insert_Click(object sender, EventArgs e) { using (BrandSCIEF frm = new BrandSCIEF(null, db)) { if (frm.ShowDialog() == DialogResult.OK) { brandSCBindingSource.DataSource = db.BrandSC.ToList(); } } }
private void Edit_Click(object sender, EventArgs e) { if (brandSCBindingSource.Current == null) { return; } using (BrandSCIEF frm = new BrandSCIEF(brandSCBindingSource.Current as BrandSC, db)) { if (frm.ShowDialog() == DialogResult.OK) { brandSCBindingSource.DataSource = db.BrandSC.ToList(); } else { db = new my_db_for_db_2Entities(); brandSCBindingSource.DataSource = db.BrandSC.ToList(); } } }