public ResultSet executeQuery(String sql)
throws SQLException
Executes an SQL statement that returns a single ResultSet object.Parameters:sql - typically this is a static SQL SELECT statementReturns:a ResultSet object that contains the data produced by the given query; never null//嗨看这里!Throws:SQLException - if a database access error occurs看懂了吗?希望能帮得了你
throws SQLException
Executes an SQL statement that returns a single ResultSet object.Parameters:sql - typically this is a static SQL SELECT statementReturns:a ResultSet object that contains the data produced by the given query; never null//嗨看这里!Throws:SQLException - if a database access error occurs看懂了吗?希望能帮得了你
// 用户名是被占用
……
}”而且用rs.afterlast()之后,getRow()得到的结果也始终是0“表示没有结果返回!!//
public boolean next()
throws SQLException
Moves the cursor down one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on. If an input stream is open for the current row, a call to the method next will implicitly close it. A ResultSet object's warning chain is cleared when a new row is read.Returns:true if the new current row is valid; false if there are no more rowsThrows:SQLException - if a database access error occurs