String sql="select top 10 isbn,title,author,publish,PublishData,price from book order by PublishData desc"; ResultSet rs=dbConnect.select(sql); try{ while(rs.next()){ %> <tr class="style1"align="left"> <td><%=rs.getString("isbn") %></td> <td><a href="bookContent.jsp?isbn=<%=rs.getString("isbn") %>"target="blank"><%=rs.getString("title") %></a></td> <td><%=rs.getString("author") %></td> <td><%=rs.getString("publish") %></td> <td><%=rs.getString("PublishDate") %></td> <td align="center"><%=rs.getFloat("price") %></td> <td><div align="center"><a href="bookOrder.jsp?isbn=<%=rs.getObject(1)%>"><img src="images/sy_img/1.jpg"width="45"height="16"border="0"></a></div></td> </tr> <%} dbConnect.close();}catch (SQLException e) { e.printStackTrace();} %>
public ResultSet select(String sql) { try { stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = stmt.executeQuery(sql); } catch (Exception e) { e.printStackTrace(); } return rs; }
esion
蜗牛快跑0
twocold
相关分类