jiangjin.jsp~1~
资源名称:JSP02.rar [点击查看]
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:2k
源码类别:
Jsp/Servlet
开发平台:
VBScript
- <%@ page contentType="text/html; charset=GBK" %>
- <%@ page import="java.sql.*" %>
- <%@ page language="java" %>
- <HTML>
- <HEAD>
- <TITLE></TITLE>
- </HEAD>
- <BODY>
- <CENTER>
- <FONT SIZE = 5 COLOR = blue>获奖同学如下</FONT>
- </CENTER>
- <BR>
- <HR>
- <BR>
- <CENTER>
- <%
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //载入驱动程序类别
- Connection con = DriverManager.getConnection("jdbc:odbc:dsn112"); //建立数据库链接
- Statement stmt = con.createStatement(); //建立Statement对象
- ResultSet rs; //建立ResultSet(结果集)对象
- rs = stmt.executeQuery("SELECT * FROM jiangjin"); //执行SQL语句
- %>
- <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 bgcolor=silver>
- <TD><B>学 号</B></TD><TD><B>姓 名</B></TD><TD><B>性 别</B></TD>
- <TD><B>专 业</B></TD><TD><B>班 级</B></TD><TD><B>奖 金</B></TD>
- </TR>
- <%
- //利用while循环将数据表中的记录列出
- while (rs.next())
- {
- %>
- <TR bgcolor=white>
- <TD><B><%= rs.getString("stu_id") %></B></TD>
- <TD><B><%= rs.getString("name") %></B></TD>
- <TD><B><%= rs.getString("sex") %></B></TD>
- <TD><B><%= rs.getString("dept") %></B></TD>
- <TD><B><%= rs.getString("class") %></B></TD>
- <TD><B><%= rs.getString("jiangjin") %></B></TD>
- </TR>
- <%
- }
- rs.close(); //关闭ResultSet对象
- stmt.close(); //关闭Statement对象
- con.close(); //关闭Connection对象
- %>
- </TABLE>
- </CENTER>
- </BODY>
- </HTML>