manoj sharma

manoj sharma

  • NA
  • 1
  • 1.2k

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

Jul 6 2013 9:17 AM
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)