📄 tushuxiugai_result.jsp
字号:
<%@page contentType="text/html;charset=gbk" %>
<style type="text/css">
<!--
body {
background-image: url();
background-color: #FFCCFF;
}
-->
</style>
<%@page import="java.sql.*" %>
<%
String sidbook=request.getParameter("idbook");
String idbook=new String(sidbook.getBytes("iso-8859-1"));
String scategoryname=request.getParameter("categoryname");
String categoryname=new String(scategoryname.getBytes("iso-8859-1"));
String sbookname=request.getParameter("bookname");
String bookname=new String(sbookname.getBytes("iso-8859-1"));
String sauthor=request.getParameter("author");
String author=new String(sauthor.getBytes("iso-8859-1"));
String ssuppliername=request.getParameter("suppliername");
String suppliername=new String(ssuppliername.getBytes("iso-8859-1"));
String soutday=request.getParameter("outday");
String outday=new String(soutday.getBytes("iso-8859-1"));
String sprice=request.getParameter("price");
String price=new String(sprice.getBytes("iso-8859-1"));
String sstock=request.getParameter("stock");
int stock=Integer.parseInt(sstock); //将字符转换为数字
String sfabu=request.getParameter("selectfabu");
String fabu=new String(sfabu.getBytes("iso-8859-1"));
String shotdeal=request.getParameter("selecthotdeal");
String hotdeal=new String(shotdeal.getBytes("iso-8859-1"));
String spicture=request.getParameter("picture");
String picture=new String(spicture.getBytes("iso-8859-1"));
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=webapps/booksystem/db/bs.mdb;");
Statement sql=con.createStatement();
ResultSet rs=sql.executeQuery("select * from books where idbook='"+idbook+"'");
if(rs.next())
{/*
sql.executeUpdate("update books(categoryname,bookname,author,suppliername,outday,price,stock,fabu,hotdeal,picture) set('"+categoryname+"','"+bookname+"','"+author+"','"+suppliername+"','"+outday+"','"+price+"','"+stock+"','"+fabu+"','"+hotdeal+"','"+picture+"') ");
out.print("<strong>已将图书(图书编号:'"+idbook+"')修改成功!</strong>"+"<p>");
sql.executeUpdate("update books set idbook='"+idbook+"' where idbook='"+idbook+"'");
*/
sql.executeUpdate("update books set categoryname='"+categoryname+"' where idbook='"+idbook+"'");
sql.executeUpdate("update books set bookname='"+bookname+"' where idbook='"+idbook+"'");
sql.executeUpdate("update books set author='"+author+"' where idbook='"+idbook+"'");
sql.executeUpdate("update books set suppliername='"+suppliername+"' where idbook='"+idbook+"'");
sql.executeUpdate("update books set outday='"+outday+"' where idbook='"+idbook+"'");
sql.executeUpdate("update books set price='"+price+"' where idbook='"+idbook+"'");
sql.executeUpdate("update books set stock='"+stock+"' where idbook='"+idbook+"'");
sql.executeUpdate("update books set fabu='"+fabu+"' where idbook='"+idbook+"'");
sql.executeUpdate("update books set hotdeal='"+hotdeal+"' where idbook='"+idbook+"'");
sql.executeUpdate("update books set picture='"+picture+"' where idbook='"+idbook+"'");
out.print("<strong>已将图书(图书编号:'"+idbook+"')修改成功!</strong>"+"<p>");
}
else{
out.print("<strong>暂无此书(图书编号:'"+idbook+"')!</strong>"+"<p>");
}
/*
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();
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -