Function works only with hard coded values
<p>This is the code I am working on:</p>

<pre><code>if(connection.doDatabaseRead(findSQL))
  {
      ResultSet retRES = connection.getResultSet();

      int i = 0;

      // did we find anything
      while( retRES.next() )
      {        
          //read result from query
          suiteNum.add(retRES.getString(i)); // this is the problem 

          i++;

          //let other threads breathe
          Thread.yield();   
      }   
  }
</code></pre>

<p><code>suiteNum</code> is a string vector</p>

<p>When I try to add the database results to the vector the code crashes with this error.</p>

<pre><code>java.sql.SQLException: Column Index out of range, 0 &gt; 1. 
</code></pre>

<p>I have the same piece of code working elsewhere in the program but I use real numbers like 0, 1 and 2 instead of i and it works fine.</p>

<p>As I do not know how many results the database request will have I need it to be dynamic but it will only work hard coded. 
How can I make it work with i ? </p>
