江都吴堡中学吧 关注:4贴子:40
  • 0回复贴,共1
<%try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+request.getRealPath("/")+"stu.mdb";
Connnection con=DriverManager.getConnnection(url);
Statement statement=con.createStatement();
ResultSet rs=null;
%>
<table align=center border=0>
<tr align=center><td>name</td><td>sex</td><td>class</td><td>math</td><td>physics</td><td>chemistry</td></tr>
<%
String Srting_SQL="select * from student";
rs=statement.executeQuery(String_SQL);
while(rs.next()){
out.println("<tr align=center>");
out.println("<td>"+rs.getString("name")+"</td>");
out.println("<td>"+rs.getString("sex")+"</td>");
out.println("<td>"+rs.getString("class")+"</td>");
out.println("<td>"+rs.getString("math")+"</td>");
out.println("<td>"+rs.getString("physics")+"</td>");
out.println("<td>"+rs.getString("chemistry")+"</td>");
out.println("</tr>");}
rs.close();
statement.close();
con.close();
%></table>
}
%>


IP属地:江苏1楼2016-04-26 11:53回复