不知道怎么回事
以下是我的代码: 
public ResultSet getResultSet(Statement stmt, String sql) {
ResultSet rs = null;
try {
if (stmt != null) {
rs = stmt.executeQuery(sql);
}
} catch (SQLException e) {
e.printStackTrace();
}
return rs;
}当执行到
rs = stmt.executeQuery(sql);程序就停止不前了。
到底是怎么回事啊?????

解决方案 »

  1.   

    以下代码  调用刚才的方法public String find_bgsbhByDate(String date) {
    String result = null;
    String sql = "select max(substring(bgsbh,17,4)) from ylrqdj_jyjl where bgsbh like 'Y107________"
    + date + "%'";
    Connection con = DBConnection.getInstance().getConn();
    Statement stmt = DBConnection.getInstance().getStatement(con);
    ResultSet rs = DBConnection.getInstance().getResultSet(stmt, sql);
    try {
    while (rs.next()) {
    result = rs.getString(1);
    }
    } catch (Exception e) {
    e.printStackTrace();
    }
    DBConnection.getInstance().closeRs(rs);
    DBConnection.getInstance().closeStmt(stmt);
    DBConnection.getInstance().closeConn(con);
    return result;
    }
      

  2.   

    调试中看一下你的 sql 语句是什么。
      

  3.   

    select max(substring(bgsbh,17,4)) from ylrqdj_jyjl where bgsbh like 'Y107________2012-01-10'有什么错吗