<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<%@ page
language="java"
import="java.sql.*"
contentType="text/html; charset=GBK"
pageEncoding="GBK"
%>
<META http-equiv="Content-Type" content="text/html; charset=GBK">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>dbtest.jsp</TITLE>
</HEAD>
<BODY>
<P> 員工列表</P>
<table border=1>
<%String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=liveflow";
String user ="sa";//資料庫使用者名稱
String password = "sa";//資料庫使用者密碼
String sqlStr = "select * from employee_base";
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection( url, user, password );
Statement st = con.createStatement();
ResultSet rs = st.executeQuery( sqlStr );
while(rs.next())
{%>
<tr><td><%=rs.getString("employee_id")%></td><td><%=rs.getString("employee_name")%></td><td><%=rs.getString("post_name")%></td><td><%=rs.getString("rela_phone")%></td><td><%=rs.getString(6)%></td></tr>
<% }%>
<%
rs.close();
st.close();
con.close();
%>
</table>
</BODY>
</HTML>