Professional Documents
Culture Documents
System
System
0;Data Source=<<Your Database Path>>"); OleDbCommandcmd=new OleDbCommand(); for (int i = 0; i < dataGridView1.Rows.Count; i++) { DataGridViewRowMyRow = dataGridView1.Rows[i]; if (MyRow.Selected == true) { dataGridView1.Rows.RemoveAt(i); try { conn.Open(); //Here It Will Delete your Row From The Database Depending On Your Id.... cmd.CommandText = "DELETE FROM MyTable Where Id=" + i + ""; cmd.ExecuteNonQuery(); conn.Close(); } catch(Exception ex) { MessageBox.Show(ex.ToString()); } }