I have a method that takes in a index off a selected index of a gridview and reads a record off a table in a sql server db. The command object uses a stored procedure. The stored procedure works as expected when executed on the db.
The data reader will work as expected if you run the method enough times. The problem is it takes two or more runs of the method to get the correct data. Typically, the first time you run the method, the datareader comes back with a blank datarow. The second or more time it will come back with the expected data.
I am using ASP.net with ajax. I don't think it is a problem with the ajax bedause the code will run through on every click, it's just the datareader that does not work.
private void ShowIssue(int intRecord)
SqlCommand comGetTicket = new SqlCommand("sp_GetHelpDeskIssuesByID", SqlConn);
comGetTicket.CommandType = CommandType.StoredProcedure;
//Use dataset to get data
SqlDataReader reader = comGetTicket.ExecuteReader();
this.pnlMessage.Visible = false;
this.lblMessage.Text = "";
this.ddlEmployee.SelectedValue = reader["EmployeeID"].ToString();
this.ddlDepartments.SelectedValue = reader["DepartmentID"].ToString();
this.ddlType.SelectedValue = reader["TypeID"].ToString();
this.btnSave.Text = "Update Ticket";
catch (Exception ex)