|
这个是我从网上下的下程序,小改了一下,还是不能成功 <%@ page contentType="text/html;charset=gb2312" %> <%@ page import="java.sql.*" %> <%@ page import="java.util.*" %> <html> <body> <table cellSpacing="0" cellPadding="0" width="780" align="center" border="0"> <tr> <td vAlign="top" align="center" width="780" > <img alt="" src="img/2c4be619.jpg" /> </td> </tr> </table> <% out.println("<b>姓名列</b><p>"); try{ Class.forName("com.sybase.jdbc.SybDriver").newInstance(); String url =" jdbc:sybase:Tds:localhost:5000/Employee";//Test为你的数据 库名   roperties SysProps = System.getProperties(); SysProps.put("user","sa"); SysProps.put("password",""); Connection conn= DriverManager.getConnection(url, SysProps); Statement stmt=conn.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); String sql="select * from projcet"; ResultSet rs=stmt.executeQuery(sql); while(rs.next()) { out.println(rs.getString(2)+"<br>"); }catch(SQLException e) { out.println(e.getMessage()); } catch(Exception e){ out.println(e.getMessage()); } %> </body> </html> |