2
Answers

delete datagridview records

ta mu

ta mu

10y
1.2k
1
i want to delete record which is selected in datagridview from database but i got error

  SqlCommand cmd = new SqlCommand();
               cmd.CommandText = "DELETE FROM addcustomer WHERE ccount_No=" + dataGridView1.SelectedRows[0].Cells[0].Value.ToString() + "";
               my.Open();

               cmd.Connection = my;
              cmd.ExecuteNonQuery();


error is
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index


plz help me

Answers (2)