<%@ page contentType="text/html;charset=gbk" import="java.sql.*"%>
<html>
<body>
<font size="20">
<%
Connection con =null;
Statement stmt =null;
ResultSet rs = null;
String sql = "";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:st","","");
stmt = con.createStatement();
sql = "select * from stud";
rs = stmt.executeQuery(sql);
out.print("姓名"+" "+"年龄"+" "+"性别"+" "+"地址<br>");
while(rs.next()){
out.print(rs.getString("username")+" "+rs.getInt("age")+" "+rs.getString("sex")+" "+rs.getString("address")+"<br>");
}
con.close();
}catch(Exception e){e.printStackTrace();}
%>
</font>
</body>
</html>
<%@ page contentType="text/html;charset=gbk" import="java.sql.*"%>
<html>
<body>
<font size="20">
<%
Connection con =null;
Statement stmt =null;
ResultSet rs = null;
String sql = "";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:st","","");
stmt = con.createStatement();
sql = "select * from stud";
rs = stmt.executeQuery(sql);
out.print("姓名"+" "+"年龄"+" "+"性别"+" "+"地址<br>");
while(rs.next()){
out.print(rs.getString("username")+" "+rs.getInt("age")+" "+rs.getString("sex")+" "+rs.getString("address")+"<br>");
}
con.close();
}catch(Exception e){e.printStackTrace();}
%>
</font>
</body>
</html>
<%@ page contentType="text/html;charset=gbk" import="java.sql.*"%>
<html>
<body>
<font size="20">
<%
Connection con =null;
Statement stmt =null;
ResultSet rs = null;
String sql = "";
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:st","","");
stmt = con.createStatement();
sql = "select * from stud";
rs = stmt.executeQuery(sql);
out.print("姓名"+" "+"年龄"+" "+"性别"+" "+"地址<br>");
while(rs.next()){
out.print(rs.getString("username")+" "+rs.getInt("age")+" "+rs.getString("sex")+" "+rs.getString("address")+"<br>");
}
con.close();
}catch(Exception e){e.printStackTrace();}
%>
</font>
</body>
</html>
posted on 2009-03-30 11:55
鹏凌 阅读(128)
评论(0) 编辑 收藏