如何獲得java.sql.ResultSet的大???這不是一個很簡單的操作嗎?但是,我發(fā)現(xiàn)沒有size()也不length()方法。
3 回答

守著星空守著你
TA貢獻1799條經(jīng)驗 獲得超8個贊
SELECT COUNT(*) FROM ...
int size =0;if (rs != null) { rs.last(); // moves cursor to the last row size = rs.getRow(); // get row id }

繁星淼淼
TA貢獻1775條經(jīng)驗 獲得超11個贊
ResultSet rs = ps.executeQuery();int rowcount = 0;if (rs.last()) { rowcount = rs.getRow(); rs.beforeFirst(); // not rs.first() because the rs.next() below will move on, missing the first element}while (rs.next()) { // do your standard per row stuff}
添加回答
舉報
0/150
提交
取消