I wish to ask how i can delete the both database and selected row from data grid view by using C# windows form button??
This was the code i using --
privatevoid del_list_Click(object sender, EventArgs e) { System.Collections.ArrayList alv = new System.Collections.ArrayList();int i = 0; OleDbCommand delcmd = new OleDbCommand();for (i = 0; i < dataGridView1.Rows.Count; i++) { DataGridViewRow delrow = dataGridView1.Rows[i];if (delrow.Selected == true) { dataGridView1.Rows.RemoveAt(i);try { delcmd.CommandText = "DELETE FROM Receive WHERE CustCode=" + i + "";int count = delcmd.ExecuteNonQuery(); }catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } }
and getting some kind of error like this--
http://www.mypicx.com/02212011/Error_Msg/