chakan2.jsp~6~
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:3k
源码类别:

Jsp/Servlet

开发平台:

VBScript

  1. <%@ page contentType="text/html; charset=GBK" %>
  2. <%@ page import="java.sql.*" %>
  3. <%@ page language="java" %>
  4. <%@ page import="java.util.*" %>
  5. <%@ page import="proj112.*" %>
  6. <jsp:useBean id="a" scope="page" class="proj112.dbconn"/>
  7. <html>
  8. <head>
  9. <title>
  10. chakan1_2
  11. </title>
  12. </head>
  13. <body bgcolor="#ffffff">
  14.    <%
  15.        String kechenghao=request.getParameter("kechenghao");
  16.        int totalrecord = 0;
  17.        String sql="";
  18.        String sql1="";
  19.        String sql2="";
  20.        String name="";
  21.        sql="SELECT * FROM chengji where 课程号='"+kechenghao+"'";
  22.        ResultSet rs=a.executeQuery(sql);
  23.  if(rs.next())
  24.    {
  25.      name=rs.getString("课程名");
  26.      %>
  27.      <br> 课程号:<%=kechenghao %>&nbsp;&nbsp; 课程名:<%=name %>,选修该课学生成绩如下:<br><br><hr><br><br>
  28.      <%  sql1 = "SELECT count(*) as recordcount FROM 成绩关联 where 课程号='"+kechenghao+"'";
  29.      ResultSet bs = a.executeQuery(sql1);
  30.      if (bs.next())
  31.      {
  32.        totalrecord = bs.getInt("recordcount");
  33.        if(totalrecord!=0){
  34.          sql2="SELECT * FROM student,成绩关联 where student.stu_id=成绩关联.stu_id and 成绩关联.课程号='"+kechenghao+"'";
  35.          ResultSet ts=a.executeQuery(sql2);
  36.          %>
  37.          <p align="center">
  38.       <table  cellspacing="0" cellpadding="4" rules="all" bordercolor="#CC9966" border="1" id="dg_rxkb" style="background-color:White;border-color:#CC9966;border-width:1px;border-style:None;width:100%;border-collapse:collapse;">
  39.              <tr>
  40.                <td align="center"><font color="#6633CC">姓名</font></td>
  41.                <td align="center"><font color="#6633CC">学号</font></td>
  42.                <td align="center"><font color="#6633CC">性别</font></td>
  43.                <td align="center"><font color="#6633CC">成绩</font></td>
  44.                <td align="center"><font color="#6633CC">重修成绩</font></td>
  45.              </tr>
  46.              <%
  47.              while(ts.next()){%>
  48.              <tr>
  49.                <td align="center"><%=ts.getString(1)%></td>
  50.                <td align="center"><%=ts.getString(2)%></td>
  51.                <td align="center"><%=ts.getString(4)%></td>
  52.                <td align="center"><%=ts.getString(24)%></td>
  53.                <td align="center"><%=ts.getString(25)%></td>
  54.              </tr>
  55.              <%} %>
  56.            </table><br >
  57.          <center>
  58.            该基础课有成绩的人数为:&nbsp;&nbsp;<input type="text" value="<%=totalrecord%>" size="2" align="right" readonly="readonly">&nbsp;人
  59.          </center>
  60.            <%}else
  61.            {%>
  62.            <script language="javascript">
  63.            alert("没有选修这门课程的学生");
  64.            history.go(-1);
  65.            history.go(0);
  66.            </script>
  67.            <%}
  68.            }else
  69.            {%>
  70.            <script language="javascript">
  71.            alert("没有选修这门课程的学生");
  72.            history.go(-1);
  73.            history.go(0);
  74.            </script>
  75.            <%}
  76.            }
  77.    else
  78.      {%>
  79.      <script language="javascript">
  80.      alert("没有你输入的课程号,请重新输入");
  81.      history.go(-1);
  82.      history.go(0);
  83.      </script>
  84.    <%}
  85.       %>
  86. </body>