|
|
| 用jsp如何读取access数据库 |
| 作者:佚名 来源:不详 发布时间:2006-5-9 16:04:40 发布人:chinazhan |
减小字体
增大字体
<%@page import="java.sql.*" import ="java.util.*" import ="java.io.*" import="java.text.*" contenttype="text/html; charset=gb2312" buffer="20kb" %><%! int all,i,m_count; string odbcquery; connection odbcconn; statement odbcstmt; resultset odbcrs; string username,title,content,work,email,url,time,date; string datetime; %> <% try{ class.forname("sun.jdbc.odbc.jdbcodbcdriver"); }catch (classnotfoundexception e) { out.print ("驱动程序不存在"); } try{ odbcconn = drivermanager.getconnection("jdbc:odbc:db1"); odbcstmt = odbcconn.createstatement(); odbcquery="select * from book where datetime>2001-4-26 order by datetime desc"; odbcrs=odbcstmt.executequery(odbcquery); int i=0; while (i<130) odbcrs.next(); while (odbcrs.next()) { //*/////////////////////////显示的内容用于调试程序是用// int ii; try{ try{ for (ii=1;;ii++) out.print (" cloumn "+ii+" is: "+odbcrs.getstring(ii)); }catch (nullpointerexception e) { out.print ("有空的指针"); } }catch (sqlexception e){ } } odbcrs.close(); odbcstmt.close(); odbcconn.close(); }catch (sqlexception e) { out.print (e); } %>
|
| |
|
[]
[返回上一页]
[打 印]
[收 藏] |
|
| ∷相关文章评论∷ (评论内容只代表网友观点,与本站立场无关!) [更多评论...] |
|
|