方法1/ while 循环中使用它来迭代结果集
ResultSet 对象,是指向其当前数据行的指针。最初,指针被置于第一行之前。next 方法将指针移动到下一行;因为该方法在 ResultSet 对象中没有下一行时返回 false,所以可以在 while 循环中使用它来迭代结果集。举例如下:
stmt = conn.createStatement(); rs = stmt.executeQuery(sql); try { while (rs.next()) { if(rs.getString("HTZT").equals(str)){ return true; } } } catch (SQLException e) { e.printStackTrace(); }