searchscore.jsp~24~
资源名称:JSP02.rar [点击查看]
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:3k
源码类别:
Jsp/Servlet
开发平台:
VBScript
- <%@page contentType="text/html;charset=gb2312"%>
- <%@page import="java.sql.*"%>
- <HTML>
- <head><SCRIPT language="JavaScript">
- function a() {
- if(form1.keywords.value==""){
- alert("用户名不能为空,请确定后重新输入");
- form1.keywords.focus();
- return false;
- }
- return true;
- }</script>
- </head>
- <BODY background="img/main_5.jpg"><br>
- <%
- Connection conn = null;
- Statement stmt = null;
- ResultSet rs = null;
- try{
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- }
- catch(ClassNotFoundException ce){
- out.println(ce.getMessage());
- }
- request.setCharacterEncoding("GBK");
- String str = request.getParameter("keywords");
- if( str == null)
- str = "";
- else
- try{
- conn=DriverManager.getConnection("jdbc:odbc:dsn112");
- stmt=conn.createStatement();
- rs=stmt.executeQuery("SELECT * FROM stu001 WHERE stu_id LIKE '%" + str + "%'");
- out.print("<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:99%;border-collapse:collapse;'>");
- out.print("<tr bgcolor='EcEcff' align='center'><TD>学期号</TD>");
- out.print("<TD>课程号</TD>");
- out.print("<TD>课程名</TD>");
- out.print("<TD>学分</TD>");
- out.print("<TD>成绩</TD>");
- out.print("<TD>重修成绩</TD>");
- out.print("<TD>主讲老师</TD></TR>");
- while(rs.next()){
- out.print("<tr align='center'><TD>"+rs.getString("xq_id")+"</TD>");
- out.print("<TD>"+rs.getString("co_id")+"</TD>");
- out.print("<TD>"+rs.getString("co_name")+"</TD>");
- out.print("<TD>"+rs.getString("credit_hour")+"</TD>");
- out.print("<TD>"+rs.getString("cj")+"</TD>");
- out.print("<TD>"+rs.getString("cxcj")+"</TD>");
- out.print("<TD>"+rs.getString("teacher")+"</TD></TR>");
- }
- out.print("</TABLE>");
- }
- catch(SQLException e){
- System.out.println(e.getMessage());
- }
- finally{
- stmt.close();
- conn.close();
- }
- %>
- <FORM name="form1" Action="" Method="POST">
- <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:99%;border-collapse:collapse;">
- <tr >
- <td height="40" colspan="2"><div align="center" ><font size="5" color="#000000"><strong>查找信息</strong></font></div></td>
- </tr>
- <tr ><td><font color="000000" size="4">输入姓名关键字:</td>
- <td><INPUT Type="Text" Name="keywords" Value="<%=str%>"></td></tr>
- <tr ><td height="35" colspan="2"><div align="center"><INPUT Type=Submit Value=" 查找" onClick="return a()" ></td></tr></table>
- </FORM>
- </BODY></HTML>