title: Displaying next row details from database when next button is pressed
body: <p>I am working in a project known as Employee attendance management system.For this I had created a java form.The form contains employee ID,employee name fields,next button.
     If I press next button the next employee details has to be displayed in the above two fields.In order to do this I had used for loop the problem hear appears is it is displaying last employee details from  the database.
  My code is:</p>
  
  <pre><code>           int i=1;
             try {
             ResultSet rs;
             Connection con;
             Statement st;
  
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            con = DriverManager.getConnection("jdbc:odbc:vasu");
             st = con.createStatement();
             for(i=1;i&lt;=5;++i){
          rs = st.executeQuery("select ID,EName from attendence where ID="+(i));
          while(rs.next()) {
            t1.setText(rs.getString("ID"));
            t2.setText(rs.getString("EName"));
            } 
          }
        }
  
       catch (Exception e) {
  
      }      
  </code></pre>
  
  <p>Sorry for my poor english.
  Could any one please help me..
  Well Thanks in advance.</p>