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 sende开发者_开发问答r, 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);
Never mind I solved it like this
DataRowView drv = (DataRowView)bindingSource1.Current;
string e1 = drv.Row[0].ToString();
精彩评论