jsp操作数据库 重复出现<%=rs.getInt("ID")%>出错
我用的是ODBC数据源做的如果出现两个<%=rs.getInt("ID")%>就会出错出现一个则编译通过<tr><td><%=rs.getString("name")%>...
我用的是ODBC数据源做的 如果出现两个
<%=rs.getInt("ID")%>就会出错 出现一个则编译通过
<tr>
<td><%=rs.getString("name")%></td>
<td><%=rs.getString("age")%></td>
<td><%=rs.getString("day")%></td>
<td><%=rs.getString("phone")%></td>
<td><a href="modify.jsp?id=<%=rs.getInt("ID")%>">修改</a></td>
<td><a href="delete.jsp?id=<%=rs.getInt("ID")%>">删除</a></td>
</tr>
错误代码如下
exception
javax.servlet.ServletException: No data found
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.main_jsp._jspService(main_jsp.java:116)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.sql.SQLException: No data found
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7139)
sun.jdbc.odbc.JdbcOdbc.SQLGetDataInteger(JdbcOdbc.java:3812)
sun.jdbc.odbc.JdbcOdbcResultSet.getDataInteger(JdbcOdbcResultSet.java:5642)
sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:585)
sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:603)
org.apache.jsp.main_jsp._jspService(main_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 展开
<%=rs.getInt("ID")%>就会出错 出现一个则编译通过
<tr>
<td><%=rs.getString("name")%></td>
<td><%=rs.getString("age")%></td>
<td><%=rs.getString("day")%></td>
<td><%=rs.getString("phone")%></td>
<td><a href="modify.jsp?id=<%=rs.getInt("ID")%>">修改</a></td>
<td><a href="delete.jsp?id=<%=rs.getInt("ID")%>">删除</a></td>
</tr>
错误代码如下
exception
javax.servlet.ServletException: No data found
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.main_jsp._jspService(main_jsp.java:116)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.sql.SQLException: No data found
sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7139)
sun.jdbc.odbc.JdbcOdbc.SQLGetDataInteger(JdbcOdbc.java:3812)
sun.jdbc.odbc.JdbcOdbcResultSet.getDataInteger(JdbcOdbcResultSet.java:5642)
sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:585)
sun.jdbc.odbc.JdbcOdbcResultSet.getInt(JdbcOdbcResultSet.java:603)
org.apache.jsp.main_jsp._jspService(main_jsp.java:98)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802) 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询