chakan2.jsp~2~
资源名称:JSP02.rar [点击查看]
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:3k
源码类别:
Jsp/Servlet
开发平台:
VBScript
- <%@ page contentType="text/html; charset=GBK" %>
- <%@ page import="java.sql.*" %>
- <%@ page language="java" %>
- <%@ page import="java.util.*" %>
- <%@ page import="proj112.*" %>
- <jsp:useBean id="a" scope="page" class="proj112.dbconn"/>
- <html>
- <head>
- <title>
- chakan1_2
- </title>
- </head>
- <body bgcolor="#ffffff">
- <%
- String kechenghao=request.getParameter("kechenghao");
- int totalrecord = 0;
- String sql="";
- String sql1="";
- String sql2="";
- String name="";
- sql="SELECT * FROM chengji where kch='"+kechenghao+"'";
- ResultSet rs=a.executeQuery(sql);
- if(rs.next())
- {
- name=rs.getString("kcm");
- %>
- <br> 课程号:<%=kechenghao %> 课程名:<%=name %>,选修该课学生成绩如下:<br><br><hr><br><br>
- <% sql1 = "SELECT count(*) as recordcount FROM 成绩关联 where 课程号='"+kechenghao+"'";
- ResultSet bs = a.executeQuery(sql1);
- if (bs.next())
- {
- totalrecord = bs.getInt("recordcount");
- if(totalrecord!=0){
- sql2="SELECT * FROM student,成绩关联 where student.stu_id=成绩关联.stu_id and 成绩关联.课程号='"+kechenghao+"'";
- ResultSet ts=a.executeQuery(sql2);
- %>
- <p align="center">
- <table width="500" cellpadding=3 cellspacing=0 align=center border=1 bordercolor="#FFCCCC" >
- <tr>
- <td align="center"><font color="#6633CC">姓名</font></td>
- <td align="center"><font color="#6633CC">学号</font></td>
- <td align="center"><font color="#6633CC">性别</font></td>
- <td align="center"><font color="#6633CC">成绩</font></td>
- <td align="center"><font color="#6633CC">重修成绩</font></td>
- </tr>
- <%
- while(ts.next()){%>
- <tr>
- <td align="center"><%=ts.getString(1)%></td>
- <td align="center"><%=ts.getString(2)%></td>
- <td align="center"><%=ts.getString(4)%></td>
- <td align="center"><%=ts.getString(24)%></td>
- <td align="center"><%=ts.getString(25)%></td>
- </tr>
- <%} %>
- </table><br ><hr><br>
- <center>
- 该基础课有成绩的人数为: <input type="text" value="<%=totalrecord%>" size="2" align="right" readonly="readonly"> 人
- </center>
- <%}else
- {%>
- <script language="javascript">
- alert("没有选修这门课程的学生");
- history.go(-1);
- history.go(0);
- </script>
- <%}
- }else
- {%>
- <script language="javascript">
- alert("没有选修这门课程的学生");
- history.go(-1);
- history.go(0);
- </script>
- <%}
- }
- else
- {%>
- <script language="javascript">
- alert("没有你输入的课程号,请重新输入");
- history.go(-1);
- history.go(0);
- </script>
- <%}
- %>
- </body>