List totalList = new ArrayList();Statement stmt=conn.createStatement();sql="select * from sometable";rs=stmt.executeQuery(sql);while(rs.next()){ List oneElementList = new ArrayList(); oneElementList.add(rs.getInt(1)); oneElementList.add(rs.getString(2)); ......看你有幾個columns totalList.add(oneElementList);}如果沒明白再問我吧sorry,筆誤 我明白cn_arthurs的意思,直接加rs都是可以的,但是安全性上會有問題
List totalList = new ArrayList();Statement stmt=conn.createStatement();sql="select * from sometable";rs=stmt.executeQuery(sql);while(rs.next()){ List oneElementList = new ArrayList(); oneElementList.add(rs.getInt(1)); oneElementList.add(rs.getString(2)); ......看你有幾個columns totalList.add(oneElementList);}如果沒明白再問我吧sorry,筆誤 我明白cn_arthurs的意思,直接加rs都是可以的,但是安全性上會有問題