xuanxiuke2.jsp~9~
资源名称: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>
- xuanke_1
- </title>
- </head>
- <body bgcolor="#ffffff">
- <%
- String kechenghao=request.getParameter("kechenghao");
- int totalrecord = 0;
- String sql="";
- String sql1="";
- String sql2="";
- String name="";
- sql="SELECT * FROM kecheng where kch='"+kechenghao+"'";
- ResultSet rs=a.executeQuery(sql);
- if(rs.next())
- {
- name=rs.getString("kcm");
- %>
- <br> 课程号:<font color="red"><%=kechenghao %></font> 课程名:<font color="red"><%=name %></font>,选修该课程的学生如下:<br><br><hr><br><br>
- <% sql1 = "SELECT count(*) as recordcount FROM 选课关联 where kch='"+kechenghao+"'";
- ResultSet bs = a.executeQuery(sql1);
- if (bs.next())
- {
- totalrecord = bs.getInt("recordcount");
- if(totalrecord!=0){
- sql2="SELECT * FROM 选课关联,student where 选课关联.stu_id=student.stu_id and 选课关联.kch='"+kechenghao+"'";
- ResultSet ts=a.executeQuery(sql2);
- %>
- <p align="center">
- <table width="100%" 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;">
- <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>
- <td align="center"><font color="#6633CC">政治面貌</font></td>
- </tr>
- <%
- while(ts.next()){%>
- <tr>
- <td align="center"><%=ts.getString(4)%></td>
- <td align="center"><%=ts.getString(5)%></td>
- <td align="center"><%=ts.getString(7)%></td>
- <td align="center"><%=ts.getString(8)%></td>
- <td align="center"><%=ts.getString(9)%></td>
- <td align="center"><%=ts.getString(10)%></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>
- </html>