title: Returning a specific value from a database ASP.NET/C#
body: <p>My question involves returning a specific value from a table in a database. I want to have it where after you login, it displays the name of the user's first and last name. </p>
  
  <p>The table looks like this. </p>
  
  <p><strong>Person</strong></p>
  
  <pre><code>UID(PK), FName, LName, Uname, Upass
  </code></pre>
  
  <p>How do I return just the <code>Fname</code> and <code>LName</code> so I can place it in a label? </p>
  
  <p>Here is my current code. Keep in mind this is for the master page. </p>
  
  <pre><code>string strConn = WebConfigurationManager.ConnectionStrings["cloud2"].ConnectionString;
  
  protected void btnlogin2_Click(object sender, EventArgs e)
  {
      string strCmd = "Select * From Person Where uname = @uname and upass = @upass";
  
      SqlConnection objConn = new SqlConnection(strConn);
  
      SqlCommand objCmd = new SqlCommand(strCmd, objConn);
      objCmd.Parameters.AddWithValue("@uname", txtusername.Text);
      objCmd.Parameters.AddWithValue("@upass", txtpassword.Text);
  
      using (objConn)
      {
          objConn.Open();
          SqlDataReader objDR = objCmd.ExecuteReader();
  
          if (objDR.HasRows)
          {
              btnlogin2.Visible = false;
              txtusername.Visible = false;
              txtpassword.Visible = false;
  
              Response.Redirect("member.aspx");
  
              lblLogin.Text = "Logged in as: Test " ; //Display login name?
          }
          else
          {
              btnlogin2.Text = "Failed";
          }
      } 
  }
  </code></pre>