ResultSet: Exception: set type is TYPE_FORWARD_ONLY — why?
问题 I have very simple code: pstat=con.prepareStatement("select typeid from users where username=? and password=?"); pstat.setString(1, username); pstat.setString(2, password); rs=pstat.executeQuery(); int rowCount=0; while(rs.next()) { rowCount++; } rs.beforeFirst(); if(rowCount>=1) { while(rs.next()) { typeID=rs.getInt(1); } But when execute this code I am getting... java.sql.SQLException: Result set type is TYPE_FORWARD_ONLY at sun.jdbc.odbc.JdbcOdbcResultSet.beforeFirst(Unknown Source) at