如何从C#visual studio中的datagridview和microsoft access数据库中删除选定的行

时间:2017-03-11 02:50:41

标签: c# database visual-studio datagridview rows

我非常需要你的学校项目帮助

我创建了一个用按钮删除的选定行,当我按下后退按钮时,它不会将删除的行保存在数据库中,我使用的是Microsoft Access“ACCDB”文件格式。

我选择的删除按钮代码:

private void button4_Click(object sender, EventArgs e)
{
    if (MessageBox.Show("Are you sure you want to delete this employee", "confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes)
    {
        {
            selectedRow = dataGridView1.CurrentCell.RowIndex;
            dataGridView1.Rows.RemoveAt(selectedRow);
        }
    }
}

我的代码返回按钮:

private void button3_Click_1(object sender, EventArgs e)
{
    Form3 A = new Form3();
    A.Show();
    this.Hide();
}

0 个答案:

没有答案