欢迎光临
我们一直在努力

用jsp如何读取access数据库-JSP教程,Jsp/Servlet

建站超值云服务器,限时71元/月

<%@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);

}

%>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 用jsp如何读取access数据库-JSP教程,Jsp/Servlet
分享到: 更多 (0)

相关推荐

  • 暂无文章