使用jsp代码从SQL SERVER中检索数据

时间:2016-05-28 06:27:39

标签: sql-server jsp servlets

    <tr>
              <th> ID number</th>
              <th>spare part id</th>
              <th>name</th>
              <th> model</th>
              <th>Price</th>
               <th> Expire Date</th>
              <th> Manufacture Date</th>
              <th>state</th>
      </tr>

      <% while (rs.next()){ %>

      <tr>
      <td class="container"> <%out.print(rs.getInt(0)); %></td>
      <td class="container"> <%out.print(rs.getString(1)); %></td>
      <td class="container"> <%out.print(rs.getString(3)); %></td>
      <td class="container"> <%out.print(rs.getString(4)); %></td>
      <td class="container"> <%out.print(rs.getFloat(5)); %></td>
      <td class="container"> <%out.print(rs.getString(5)); %></td>
      <td class="container"> <%out.print(rs.getString(5)); %></td>
     <td class="container"> <%out.print(rs.getString(5)); %></td>
      </tr>

这是我的代码,以表格形式显示输出,但堆栈跟踪显示

  

&#34; javax.servlet.ServletException:   com.microsoft.sqlserver.jdbc.SQLServerException:索引0不在   。范围&#34;

有谁可以帮助我

1 个答案:

答案 0 :(得分:0)

我在放置闭合支架时出错了。我收到了我的错误