嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 5 元微信扫码支付:5 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
有学生,教师,和管理员三类角色
带界面,带报告,带java代码和sql数据库
主要功能的sql语句:
修改密码:update student set pwd=? where stuid=?
成绩录入: update sc set examscore=? where stuid=? and courid=?;(期末成绩)
float finalscore= (float) (dailyscore*0.3 examscore*0.7);
String sql="update sc set finalscore=? where stuid=? and courid=?";(最终成绩)
查看学生信息:SELECT * FROM " table " WHERE stuid=?
添加学生信息:insert student values(?,?,?,?,?,?,?)
删除学生信息:delete from student where stuid=?
修改学生信息:update student set name=?,pwd=?,sex=?,age=?,dept=?,
clsid=? where stuid =?
成绩查询:select stuid,sc.courid,dailyscore,examscore,finalscore from sc,course c where stuid=? and sc.courid=c.courid(单人)
select sc.stuid,sc.courid,sum(finalscore) sum,round(avg(finalscore)) avg from sc where sc.stuid in (select student.stuid from student where student.clsid=?) group by sc.stuid order by avg desc(班级)
<form action="StuLoginServlet" method="post" style="padding-top:-700px;">
用户:<input type="text" name="name"value=""><br>
密码:<input type="password" name="pwd"value=""><br></form>
说明:通过表单传递用户名和密码的参数发送到Servlet
String name = req.getParameter("name");
String pwd = req.getParameter("pwd");
ud.selectByIdPwd(name, pwd);
说明:在Servlet中获取参数,并调用布尔方法判断表中是否有该用户
public boolean selectByIdPwd(String name, String pwd) {
boolean flag = false;
Connection conn=DBconn.init();
String sql="select * from " table " where stuid=? and pwd=?";
try {
PreparedStatement pstmt=conn.prepareStatement(sql);
pstmt.setString(1,name);
pstmt.setString(2,pwd);//通过调用方法时传进的参数来给?赋值
ResultSet rs=pstmt.executeQuery();
while(rs.next()){
if(rs.getString("stuid").equals(name) && rs.getString("pwd").equals(pwd)){
flag=true;
}
}
DBconn.close(conn, pstmt, rs);
} catch (SQLException e) {
e.printStackTrace();
}
return flag;
}