private void Delete_Click(object sender, EventArgs e) { try { using (var context = new AdventureWorks2012Entities()) { var per = context.People.Where(p => p.BusinessEntityID == 292).First(); context.DeleteObject(per); context.SaveChanges(); MessageBox.Show("record deleted"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }