SQLException: Operation not allowed after ResultSet closed

前端 未结 2 1680
遇见更好的自我
遇见更好的自我 2021-01-24 20:29

I\'m trying to execute the getPendingSalesOrderIDs() method which calls upon method selectInAsending(...).

But this shows a SQLException saying java.sql.SQLException:

2条回答
  •  北海茫月
    2021-01-24 20:45

    If db.endSelect() closes your ResultSet, why not remove it (in the selectInAsending() method)?

    You can close your ResultSet in the getPendingSalesOrderIDs() method like so:

    ResultSet r = null;
    
    try {
        ResultSet r = salesOrder.selectInAsending("soNo", "productionStatus = 'pending' and formatID='Zn-Al'", "soNo");
    
    } catch (SQLException e) {
    
    } finally {
        if (r != null) {
            try {
                r.close();
            } catch (SQLException e) {
    
            }
        }
    }
    

提交回复
热议问题