ResultSet exception - before start of result set

后端 未结 6 810
独厮守ぢ
独厮守ぢ 2020-11-21 23:30

I\'m having trouble getting data from a ResultSet object. Here is my code:

    String sql = \"SELECT type FROM node WHERE nid = ?\";
    PreparedStatement pr         


        
6条回答
  •  臣服心动
    2020-11-22 00:21

    You need to move the pointer to the first row, before asking for data:

    result.beforeFirst();
    result.next();
    String foundType = result.getString(1);
    

提交回复
热议问题