你可以测试一下第一次rs.next()返回什么值,rs当空值时。

解决方案 »

  1.   

    取出来为空了,你再NEXT,
    然后你再getString 这时候去那里GET哦,当然出错里
      

  2.   

    在循环前先判断是否为空,如果为空,就出现别的,不为空的时候才WHILE循环
      

  3.   

    rs = stmt.executeQuery(sql);
    这里得到的RS要是空的话 可能就会报nullpointerException的
      

  4.   

    1 取RS值,看有无结合。
    2 i++是什么?
      

  5.   

    * Moves the cursor down one row from its current position.
         * A <code>ResultSet</code> cursor is initially positioned
         * before the first row; the first call to the method
         * <code>next</code> makes the first row the current row; the
         * second call makes the second row the current row, and so on. 
         *
         * <P>If an input stream is open for the current row, a call
         * to the method <code>next</code> will
         * implicitly close it. A <code>ResultSet</code> object's
         * warning chain is cleared when a new row is read.
         *
         * @return <code>true</code> if the new current row is valid; 
         * <code>false</code> if there are no more rows 
         * @exception SQLException if a database access error occursnext()的说明。
    不是循环的问题。