title: Resultset get all values
body: <p>How can i get all the values from all the columns?</p>
  
  <p>Ive tried with this code:</p>
  
  <pre><code> values.add(rs.getString(number));
  </code></pre>
  
  <p>Where number is the rowcount.</p>
  
  <p>But it only gives me all the values from the last column.</p>
  
  <p>I need to grab the values from every column and then add it to the arraylist.</p>
  
  <p>This is my full code:</p>
  
  <pre><code>  // The column count starts from 1
    int number = 0;
    for ( i = 1; i &lt; columnCount + 1; i++ ) {
    number++;
    ColumnNames = rsmd.getColumnName(i);
  
    ar.add(ColumnNames);
    System.out.println(ar);  
    }
   model.setColumnCount(columnCount);
  
    while ( rs.next() ) {
  // values.add(rs.getString(ar.indexOf(i)));
  values.add(rs.getString(number));
   System.out.println(values);
  
  
  
       model.addRow(new Object[] {value1,  value2, value3, value4});
  
    }
  </code></pre>