private void buttonDel_Click(object sender, EventArgs e) { if (dataGridView.SelectedRows.Count == 1) { if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value); try { Bank.Delete(new BankBindingModel { Id = id }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } LoadData(); } } }
public static bool Delete(int bankId) { return(dal.Delete(bankId)); }
/// <summary> /// 删除一条数据 /// </summary> public bool Delete(string CODE) { return(dal.Delete(CODE)); }