Change your code to this if you want the labels/texboxes to contain data from the first row and res to have a count of rows at the end of the loop:
while(myReader.Read())
{ ++res;
if (res == 1) {
lbl6.Text = "<b>Connection is: </b>" + myCon.State;
lbl6.Text += "<br><b>Success: </b>Search made.";
txtClass.Text = myReader["Class"].ToString();
txtID.Text = myReader["StudentID"].ToString();
txtName.Text = myReader["StudentName"].ToString();
}
}
//At this point res will contain the record count
//the labels & textboxes will contain the information from the first data row