java - Do I need next() for a ResultSet with one row? -


i have following code

statement stmt = sqlhelper.initializedb(); string query = "select status " +                  "from books " +                  "where bookid = '" + bookid + "'"; resultset rs = stmt.executequery(query); result = rs.getstring(1); rs.close(); sqlhelper.closeconnection(); 

do need use rs.next()? sure there going 1 row of data because bookid must unique in table. default, cursor of resultset starts before first row i'm not sure if need next() or not.

yes need next()

a resultset object maintains cursor pointing current row of data. cursor positioned before first row...


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -