部分代码:
while(rs.next()){   //遍历结果集
for(int i = 0 ; i < columnIndex ; i++){   //columnIndex :获取的表的总列数
rs.getString(i);   //得到每列的数据。
}
}此时如何用一个字符串数组来保存对应的每一列里的每一行数据,并且返回这个字符串数组,急.......

解决方案 »

  1.   

    while(rs.hasNext()){   //遍历结果集
        String []str = new String[columnIndex ];
        for(int i = 0 ; i < columnIndex ; i++){   //columnIndex :获取的表的总列数
           str[i]= rs.next().getString(i);   //得到每列的数据。
        }
       // 对str进行操作
    }
      

  2.   

    rs.next().getString(i); 
    有这个用法?
      

  3.   

    while(rs.hasNext()){ //遍历结果集
      String []str = new String[columnIndex ];
      Object o = rs.next();
      for(int i = 0 ; i < columnIndex ; i++){ //columnIndex :获取的表的总列数
      str[i]= o.getString(i);
    }
    第一次写错了,谢谢提醒。