B
bukelong
Unregistered / Unconfirmed
GUEST, unregistred user!
数据源名称:delFun 里面有一张表DelFun ,代码如下,运行结果是22222222 ,希望能得到大家的帮助
<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.sql.*"%>
<html>
<head>
<title>简单数据库连接</title>
</head>
<body>
<% StringBuffer nameList=new StringBuffer();
Connection con;
Statement sql;
ResultSet rs;
try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}
catch(ClassNotFoundException e){out.print("111111111");}
try {con=DriverManager.getConnection("jdbc: odbc: delFun","","");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * FROM DelFun");
out.print("<table border>");
out.print("<tr>");
out.print("<th width=30>"+"函数名");
out.print("<th width=100>"+"作用");
out.print("</tr>");
while (rs.next())
{ out.print("<tr>");
out.print("<td>"+rs.getString(1)+"<td>");
out.print("<td>"+rs.getString(2)+"<td>");
out.print("</tr>");
}
out.print("</table>");
con.close();
}
catch(SQLException e1){out.print("22222222");}
%>
</body>
</html>
<%@ page contentType="text/html;charset=GB2312"%>
<%@ page import="java.sql.*"%>
<html>
<head>
<title>简单数据库连接</title>
</head>
<body>
<% StringBuffer nameList=new StringBuffer();
Connection con;
Statement sql;
ResultSet rs;
try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}
catch(ClassNotFoundException e){out.print("111111111");}
try {con=DriverManager.getConnection("jdbc: odbc: delFun","","");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * FROM DelFun");
out.print("<table border>");
out.print("<tr>");
out.print("<th width=30>"+"函数名");
out.print("<th width=100>"+"作用");
out.print("</tr>");
while (rs.next())
{ out.print("<tr>");
out.print("<td>"+rs.getString(1)+"<td>");
out.print("<td>"+rs.getString(2)+"<td>");
out.print("</tr>");
}
out.print("</table>");
con.close();
}
catch(SQLException e1){out.print("22222222");}
%>
</body>
</html>