Tutorial :Delete record in database with bindingnavigator



Question:

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);  


Solution:1

Never mind I solved it like this

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

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »