DBMNG数据库管理与应用

书籍是全世界的营养品。生活里没有书籍,就好像没有阳光;智慧里没有书籍,就好像鸟儿没有翅膀。
当前位置:首页 > Access > 常见问题

java.sql.SQLException:Nodatafound

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("字段名"),如需要多次调用则可以先赋值给一个变量,然后再打印或进行其他操作。
本站文章内容,部分来自于互联网,若侵犯了您的权益,请致邮件chuanghui423#sohu.com(请将#换为@)联系,我们会尽快核实后删除。
Copyright © 2006-2023 DBMNG.COM All Rights Reserved. Powered by DEVSOARTECH            豫ICP备11002312号-2

豫公网安备 41010502002439号