1
Reply

I am getting index out of range error message.. please help

Ask a question
protected void dgShow_DeleteCommand(object source, DataGridCommandEventArgs e)
    {
        SqlConnection con = new SqlConnection(str);
        SqlCommand cmd = new SqlCommand();
        int enpid = (int)dgShow.DataKeys[(int)e.Item.ItemIndex];
        cmd.CommandText = "Delete * from EmpTable where EmpId=" + enpid;       
        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();
        dgShow.EditItemIndex = -1;
        Show();     

    }
this was block of code..


Answers (1)