int secilenıd = GridView1.SelectedIndex;
GridViewRow row = GridView1.Rows[secilenıd];
string sorgu = "DELETE FROM PersonelBilgileri WHERE PersonelID='"+row.Cells[1].Text + "'";
SqlCommand cmd = new SqlCommand();
int secilenıd = GridView1.SelectedIndex;
GridViewRow row = GridView1.Rows[secilenıd];
string sorgu = "DELETE FROM PersonelBilgileri WHERE PersonelID='"+row.Cells[1].Text + "'";
SqlCommand cmd = new SqlCommand();
2
Answers
Cell with index 1 probably won’t exist. Check your grid again.
In Gridview Use datakeys in gridview control for better execution