title: to find max value from a given table in sql express
body: <p>i am trying to retrieve latest data from my database table.
  i am using max(columnName) but not having result to my liking.
  i keep getting column name instead of any value</p>
  
  <p>please help me out in this...</p>
  
  <p>the code for retrieving max value is like this</p>
  
  <pre><code>            dbConnection dbCon = new dbConnection();
              con = dbCon.doConnection();
  
              SqlCommand cmd = new SqlCommand();
  
  
              String query = "select max(studentNo) from studentInfo;";
              cmd.Connection = con;
              cmd.CommandText = query;
              SqlDataReader reader = cmd.ExecuteReader();
              while (reader.Read())
              { 
                  String x=reader["studentNo"].ToString();
  
              }
  </code></pre>
  
  <p>here the studentNo is the column name whose value i need to extract and it is of int type
  while printing the string x on my application i get studentNo instead of the value.
  now i am short of clue to solve the prob because i can't find anything wrong with the code.
  do help me in this one</p>