Queries returning multiple result sets
问题 I have a MSSQL database and am running the following query: select * from projects; select * from user The above query returns two result sets at once, and I cannot fire both queries separately. How can I handle both the result set at once in a Java class? 回答1: Correct code to process multiple ResultSet s returned by a JDBC statement: PreparedStatement stmt = ...; boolean isResultSet = stmt.execute(); int count = 0; while(true) { if(isResultSet) { rs = stmt.getResultSet(); while(rs.next()) {