Delete record in database with bindingnavigator

Hi I navigate with a bindingnavigator threw a datagridview. this datagridview is connected with a database. If I want to delete a row on the datagridview then it deletes it perfectly, But the row in the database stays.

    private void deletetoolStripButton_Click(object sender, EventArgs e)
    {
       if (MessageBox.Show("Delete record?", "Confirm", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
       {
          //bindingSource1.RemoveCurrent();
          DataGridView1.Rows.Remove(DataGridView1.CurrentRow);
       }
    }

How to fetch the record specific details for sending a parameter to the database and delete the record for real with my next function ?

deleteRecordDataGridView(parameter);

Answers


Never mind I solved it like this

          DataRowView drv = (DataRowView)bindingSource1.Current;
          string e1 = drv.Row[0].ToString();

Need Your Help

Check if data frame exists

r dataframe

What is the preferred way to check that data frame exists given you have data frame name as string? I can think of: