tushushanchu_result.jsp
上传用户:cnkaiguan
上传日期:2014-08-25
资源大小:5403k
文件大小:2k
源码类别:
Jsp/Servlet
开发平台:
Java
- <%@page contentType="text/html;charset=gbk" %>
- <%@page import="java.sql.*" %>
- <%
- String idbook=request.getParameter("idbook");
- Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
- Connection con=DriverManager.getConnection("jdbc:odbc:booksystem");
- Statement sql=con.createStatement();
- ResultSet rs=sql.executeQuery("select * from books where idbook='"+idbook+"'");
- if(rs.next())
- {
- sql.executeUpdate("Delete from books where idbook='"+idbook+"'");
- out.print(" '"+idbook+"' 此书信息已被删除!");
- }
- else
- out.print("无此书(图书编号:"+idbook+"')!");
- rs=sql.executeQuery("select * from books ");
- out.print("数据库中的书目如下: ");
- out.print("<table border>");
- out.print("<tr>");
- out.print("<th width=72>图书编号</td>");
- out.print("<th width=72>图书类别</td>");
- out.print("<th width=50>图书名称</td>");
- out.print("<th width=50>作者</td>");
- out.print("<th width=62>出 版 商</td>");
- out.print("<th width=50>出版日期</td>");
- out.print("<th width=50>售价</td>");
- out.print("<th width=50>库存(本)</td>");
- out.print("<th width=50>是否发布</td>");
- out.print("<th width=50>是否热点书</td>");
- out.print("<th width=50>出售(本)</td>");
- out.print("</tr>");
- while(rs.next())
- {
- String a,b,c,d,e,f,g,h,i,j,k;
- out.print("<tr>");
- a=rs.getString(1);
- out.print("<td>"+a+"</td>");
- b=rs.getString(2);
- out.print("<td>"+b+"</td>");
- c=rs.getString(3);
- out.print("<td>"+c+"</td>");
- d=rs.getString(4);
- out.print("<td>"+d+"</td>");
- e=rs.getString(5);
- out.print("<td>"+e+"</td>");
- f=rs.getString(6);
- out.print("<td>"+f+"</td>");
- g=rs.getString(7);
- out.print("<td>"+g+"</td>");
- h=rs.getString(8);
- out.print("<td>"+h+"</td>");
- i=rs.getString(9);
- out.print("<td>"+i+"</td>");
- j=rs.getString(10);
- out.print("<td>"+j+"</td>");
- k=rs.getString(11);
- out.print("<td>"+k+"</td>");
- out.print("</tr>");
- }
- con.close();
- %>