title: Select a data from MS SQL Server 2005
body: <p>I have a table named <code>t_Student</code> in Microsoft SQL Server 2005 database. In that table there are three columns named <code>student_regiNo</code>, <code>student_Name</code>, <code>student_Email</code>.</p>
  
  <p>I'm using following code segment to retrieve "student_Name". But instead of showing "student_Name" it shows "System.Data.SqlClient.SqlDataReader". Whats the problem?</p>
  
  <pre><code>private void GetDatabaseConnection()
  {
      string connectionString = @"server=RZS-F839AD139AA\SQLEXPRESS; Integrated Security = SSPI; database = StudentCourseInformation";
      connection = new SqlConnection(connectionString);
      connection.Open();
  }
  
  public string GateStudentName(string selectedStudentRegiNo)
  {
      GetDatabaseConnection();
  
      string selectedStudentQuery = @"SELECT student_Name FROM t_Student WHERE (
                                    student_regiNo = 
                                    '" +selectedStudentRegiNo+ @"'  
                                     )";
      SqlCommand command = new SqlCommand(selectedStudentQuery, connection);
      SqlDataReader reader = command.ExecuteReader();
  
      string selectedStudentName = Convert.ToString(reader);
      return selectedStudentName;
  }
  </code></pre>