當前位置:首頁 » 學校課程 » 資料庫製作課程表

資料庫製作課程表

發布時間: 2021-01-13 22:58:12

『壹』 help__!!__如何將資料庫中的數據導出來用jsp製作一張課程表

<%@ page contentType="text/html;charset=GB2312" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<title>使用JDBC查詢數據</title>
</head>
<body>
<center><h2>使用JDBC查詢數據</h2></center>
<table border=1 align="center">
<tr>
<td>姓名</td>
<td>性別</td>
<td>年級</td>
<td>畢業學校</td>
</tr>
<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
//創建連接
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=student";
//student為你的資料庫
String user="sa"; //用戶名
String password="sa";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet rs=stmt.executeQuery("select * from student");
while(rs.next())
{
%>
<tr>
<td><%=rs.getString("sname")%></td>
<td><%=rs.getString("ssex")%></td>
<td><%=rs.getString("sclass")%></td>
<td><%=rs.getString("school")%></td>
</tr>
<%
}
rs.close();
conn.close();
%>
</table>
</body>
</html>

熱點內容
武漢大學學生會輔導員寄語 發布:2021-03-16 21:44:16 瀏覽:612
七年級學生作文輔導學案 發布:2021-03-16 21:42:09 瀏覽:1
不屑弟高考成績 發布:2021-03-16 21:40:59 瀏覽:754
大學畢業證會有成績單 發布:2021-03-16 21:40:07 瀏覽:756
2017信陽學院輔導員招聘名單 發布:2021-03-16 21:40:02 瀏覽:800
查詢重慶2018中考成績查詢 發布:2021-03-16 21:39:58 瀏覽:21
結業考試成績怎麼查詢 發布:2021-03-16 21:28:40 瀏覽:679
14中醫醫師資格筆試考試成績查分 發布:2021-03-16 21:28:39 瀏覽:655
名著賞析課程標准 發布:2021-03-16 21:27:57 瀏覽:881
北京大學商業領袖高端培訓課程 發布:2021-03-16 21:27:41 瀏覽:919