title: SqlDataReader Read method not working
body: <p>I am trying to retrieve column values from database here is my code</p>
  
  <pre><code>protected void LoadProfile()
  {
          conn = new SqlConnection(connString);
  
          cmdProfile = new SqlCommand("SELECT Name, Father, Gender, UserName, City, Country, Department, Year, Degree, JobTittle, Organization, JobCity, JobCountry, JobTittle FROM UserProfile WHERE UserName=@UserName", conn);
  
          cmdProfile.Parameters.AddWithValue("@UserName", userName);
  
          conn.Open();
  
          reader = cmdProfile.ExecuteReader();
  
          if (reader.Read())
          {
              labelName.Text = reader["Name"].ToString();
              txtBoxFather.Text = reader["Father"].ToString();
              TextBoxGender.Text = reader["Gender"].ToString();
              TextBoxAge.Text = "";
              TextBoxCity.Text = reader["City"].ToString();
              TextBoxCountry.Text = reader["Country"].ToString();
              TextBoxDepartment.Text = reader["Department"].ToString();
              TextBoxDegree.Text = reader["Degree"].ToString();
              TextBoxYear.Text = reader["Year"].ToString();
              TextBoxJobTittle.Text = reader["JobTittle"].ToString();
              TextBoxJobCity.Text = reader["JobCity"].ToString();
              TextBoxJobCountry.Text = reader["JobCountry"].ToString();
              TextBoxOrganization.Text = reader["Organization"].ToString();
          }
  
          conn.Close();
      } 
  </code></pre>
  
  <p>But it is not retrieving  anything from database.</p>
  
  <p>Actually I am taking <code>userName</code> parameter as query string from different page using this line</p>
  
  <pre><code> userName = Request.QueryString["Name"].ToString();
  </code></pre>
  
  <p>When I put break points the control is not going forward after this line</p>
  
  <pre><code>if (reader.Read())
  </code></pre>
  
  <p>This is the page from where I am taking query string. . </p>
  
  <pre><code>&lt;asp:GridView ID="GridAllAlumni" runat="server" 
          onitemcommand="GridAllAlumni_ItemCommand"&gt;
     &lt;Columns&gt;
        &lt;asp:TemplateField&gt;
           &lt;ItemTemplate&gt;
              &lt;asp:LinkButton ID="lnkname" runat="server"
                              Text='&lt;%#Eval("Name") %&gt;'
                              PostBackUrl='&lt;%#"~/Profile/Profile.aspx?Name="+Eval("Name") %&gt;'/&gt;
           &lt;/ItemTemplate&gt;
        &lt;/asp:TemplateField&gt;
     &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>Where am I getting wrong?</p>
  
  <p>Your help will be appreciated. Thanx</p>