不知道怎么回事
以下是我的代码:
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);程序就停止不前了。
到底是怎么回事啊?????
以下是我的代码:
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);程序就停止不前了。
到底是怎么回事啊?????
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;
}