String sql1,sql2; SQLite sqlite = new SQLite(); int i=0; Access acc = new Access("E:/t1.mdb"); sql1 = "select * from con where con_class=1 and sml_class=1"; ResultSet rs = acc.executeQuery(sql1); while (rs.next()) { out.print("|"+rs.getString("con_id")); out.print("|"+rs.getString("con_content")); out.print("|"+rs.getString("con_time")); out.print("|"+rs.getString("con_pic")); out.print("<hr/><br/>"); String[] Params = { rs.getString("con_title"), rs.getString("con_content"), rs.getString("con_time")+" 00:00:01", "admin", "3", "7", "0", "t"+rs.getString("con_pic"), rs.getString("con_pic") }; sql2 = "insert into Art_Info_Tab(A_1,A_2,A_3,A_4,A_5,A_6,A_OrderId,A_Thumb,A_P) values(?,?,?,?,?,?,?,?,?)"; sqlite.executeUpdate(sql2, Params); } rs.close(); acc.close();500 Servlet Exception
[show] java.sql.SQLException: No data found javax.servlet.ServletException: java.sql.SQLException: No data found
at com.caucho.jsp.PageContextImpl.handlePageException(PageContextImpl.java:1301)
at _jsp._import__jsp._jspService(_import__jsp.java:35)
at com.caucho.jsp.JavaPage.service(JavaPage.java:64)
at com.caucho.jsp.Page.pageservice(Page.java:542)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:194)
at com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChain.java:132)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:811)
at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1215)
at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1171)
at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1155)
at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1078)
at com.caucho.network.listen.TcpSocketLink.handleAcceptTask(TcpSocketLink.java:907)
at com.caucho.network.listen.AcceptTask.doTask(AcceptTask.java:74)
at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:97)
at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:80)
at com.caucho.network.listen.AcceptTask.run(AcceptTask.java:59)
at com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:164)
at com.caucho.env.thread.ResinThread.run(ResinThread.java:130)
Caused by: java.sql.SQLException: No data found
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7138)
at sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(JdbcOdbc.java:3907)
at sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(JdbcOdbcResultSet.java:5698)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:354)
at sun.jdbc.odbc.JdbcOdbcResultSet.getString(JdbcOdbcResultSet.java:411)
at _jsp._import__jsp._jspService(import.jsp:26)
at _jsp._import__jsp._jspService(_import__jsp.java:33)
at com.caucho.jsp.JavaPage.service(JavaPage.java:64)
at com.caucho.jsp.Page.pageservice(Page.java:542)
at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:194)
at com.caucho.server.security.SecurityFilterChain.doFilter(SecurityFilterChain.java:132)
at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)
at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)
at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:289)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:811)
at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1215)
at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1171)
at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1155)
at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1078)
at com.caucho.network.listen.TcpSocketLink.handleAcceptTask(TcpSocketLink.java:907)
at com.caucho.network.listen.AcceptTask.doTask(AcceptTask.java:74)
at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:97)
at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:80)
at com.caucho.network.listen.AcceptTask.run(AcceptTask.java:59)
at com.caucho.env.thread.ResinThread.runTasks(ResinThread.java:164)
at com.caucho.env.thread.ResinThread.run(ResinThread.java:130)
发生java.sql.SQLException: No data found错误的原因在于:access不能在一个字段上连续多次调用 rs.getString("字段名"),如需要多次调用则可以先赋值给一个变量,然后再打印或进行其他操作。