jdbc如何连续查询?

vesor 04-05-15

第二次执行executeQuery()时出错:Before start of result set

Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = java.sql.DriverManager.getConnection。。。。。。。。。
stmt = conn.createStatement();

query = aaaaaaaaaaaa
rs = stmt.executeQuery(query);
rs = stmt.getResultSet();

query = bbbbbbbbb
rs = stmt.executeQuery(query);
rs = stmt.getResultSet();

rs.close();
stmt.close();
conn.close();

elegantyu
2004-05-25 11:20

rs.beforeFirst();

fiddle
2004-05-26 12:22

rs = stmt.getResultSet();