title: Iterate trougth database table rows C#
body: <p>I have in my database a table called students that have the number and name, address....<br>
  I have a form where I load all information for one student at a a time , and I have a next button and a back button.<br>
  How can I iterate to the next row (or previous row) in mysql (to be able to see the info of the next student) ?<br>
  I tried to use the primary key (auto increment) to iterate and when I want to see the next record I add 1 to the id or subtract 1 to see the previous record.<br>
  But if one record is deleted it will show an empty record. 
  Can you point me in the rigth direction?<br>
  I´m using WinForms<br>
  Sorry about my english..    </p>
  
  <pre><code>            string config = "server=localhost; userid = root; database = databaseName";
              MySqlConnection con = new MySqlConnection(config);
  
              MySqlDataReader reader = null;
              string query = "SELECT * FROM students WHERE id = " + id; //id is the primary Key (auto increment)
  
              MySqlCommand command = new MySqlCommand(query, con);
              con.Open();
              reader = command.ExecuteReader();
  
              while (reader.Read())
              {
  
                  string studentName = (string)reader["studentName"];
  
                  string studentNum = (string)reader["studentNum"];
  
                  tbstudentName.Text = Convert.ToString(studentName);
                  tbstudentNum.Text = Convert.ToString(studentNum);                   
  
                  .....
              }
              con.Close();
  </code></pre>