【发布时间】:2020-08-16 15:48:44
【问题描述】:
static boolean checkCode(String Code, Connection conn) throws SQLException {
Statement s;
String cc = null;
try {
String Statement = "SELECT Code from Courses where Code="+ Code;
s = conn.createStatement();
ResultSet rs = s.executeQuery(Statement);
while (rs.next()) {
cc = rs.getString("Code");
}
if((Code.equalsIgnoreCase(cc)))
return true;
else
return false;
}
catch (SQLException e) {}
return false;
}
我正在使用 switch 案例并且 3 个案例无法正常工作(使用课程代码删除,使用课程代码更新,并使用课程代码查看特定课程)所以我认为 checkCode 方法中的错误。有人可以帮忙吗?
【问题讨论】:
标签: java sql methods oracle11g