我写了俩个文件:ShowCategory.jsp ShowGoods.jsp
在ShowCategory.jsp中:
<jsp:useBean id="shop"scope="session"class="Club.Club_dbconnect"/>
<%
    String categoryId;
    String categoryName;
    ResultSet rs;    
    String sql="select * from category group by id,name order by id";
    rs=shop.executeQuery(sql);
%>
    <table width="80%"border="0"cellspacing="0"cellpadding="1"align="center">
       <tr bgcolor="#fcd758" align="center">
          <td>请选择类别</td>
       </tr>
      <%
       while(rs.next())
       {
                categoryId=rs.getString("id");

       categoryName=rs.getString("name");
              
        %>
       
       <tr bgcolor="#d9f499"  align="center">
         <td colspan="1">
           <a href="ShowGoods.jsp?cateId=<%=categoryId%>" ><%=categoryName%></td>            
       </tr>
         
      <%
      }
      %>
</table>
本文件正常运行。
ShowGoods.jsp为:
<%@ page  session="true" %>
<jsp:useBean id="buy"scope="page" class="Club.Club_dbconnect" />
<H3>商品如下:</H3>
   <%
         String productId;
         String productName;
         String producer;
         String price;      
        
         String categoryId=request.getParameter("cateId"); 
         ResultSet rs_1;
         String sql_1="select * from category where id="+categoryId;
         rs_1=buy.executeQuery(sql_1);
         String categoryName=rs_1.getString("name");
         ResultSet rs;
         String sql="select * from product where cateId="+categoryId;
         rs=buy.executeQuery(sql);
         
   %>
   <H4><%=categoryName%></H4>
运行时出现错误:
500 Servlet Exception
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid
operation for the current cursor position.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.validateCursorPosition(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getString(Unknown Source)
at com.microsoft.jdbc.base.BaseResultSet.getString(Unknown Source)
at _club._showgoods__jsp._jspService(/Club/ShowGoods.jsp:25)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:506)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:253)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:170)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534)请问这是什么问题导致的呢?
请各大狭看看:
谢谢啦!!!