学校在线测试系统
jsp+acce
源代码在线查看: paperdel.jsp
String classid;
String paperid;
ResultSet rs = null;
String sql = "";
int result = 0;
%>
classid = request.getParameter("classid");
paperid = request.getParameter("paperid");
// 避免用户直接在浏览器地址栏输入页面地址所产生的Exception
if(classid==null || paperid.equals("")) {
out.println("");
out.println("请进行合法操作!");
out.println("");
return;
}
try{
sql = "delete from test_paper_lib ";
sql+= " where paper_id=" + paperid;
result = conn.executeUpdate( sql );
if(result == 0 ) {
out.println("");
out.println("试卷信息删除失败!");
out.println("请将下列信息告知管理员");
out.println("单击这里返回");
out.println("");
}
// 更新班级信息表中某个班级的试卷数目
sql = "update test_classinfo set totalpaper=totalpaper-1";
sql+= " where classid='" + classid + "'";
conn.executeUpdate( sql );
}catch(Exception ee) {
out.println("");
out.println("试卷信息删除失败!");
out.println("请将下列信息告知管理员");
out.println(ee.toString() + "");
out.println("单击这里返回");
out.println("");
}
%>