title: Retrieving Individual Columns from an ADO.NET Result Set
body: <p>I have a website which is set to query a database for a username, and then populate the <code>Session[]</code> variables with the user's info.  When I query using the server's stored procedure, I get back the entire row.  How can I split apart the row and parse it so that every column gets parsed separately?</p>
  
  <p>My code for the button is:</p>
  
  <pre><code>protected void Button4_Click(object sender, EventArgs e)
  {
      string strConn = WebConfigurationManager.ConnectionStrings["TicketsConnectionString"].ConnectionString;
      SqlConnection myConnection = new SqlConnection(strConn);
      //Search button
      string sqlText = ("select * from [dbo].[User]");
  
  
  
  
  
  
      SqlCommand myCommand = new SqlCommand(sqlText,myConnection);
      myCommand.CommandType = CommandType.Text;
      myConnection.Open();
      SqlDataReader objReader;
      objReader = myCommand.ExecuteReader();
  
      objGrid.DataSource = objReader;
      objGrid.DataBind();
  }
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I updated it to <code>string sqlText = ("select 'UserID', 'FirstName' from [dbo].[User] where UserID='"+txtTest.Text+"' and Password='" + txtPass.Text+"'");</code></p>
  
  <p>But now I get the following column 
  Column1 Column2
   UserID FirstName </p>