📄 doupdate.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body><%
String id=request.getParameter("id");
String name=request.getParameter("name");
String yr=request.getParameter("yr");
String price=request.getParameter("price");
String title=request.getParameter("title");
String saleAmount=request.getParameter("saleAmount");
String description=request.getParameter("description");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
//数据库连接字符串
String url ="jdbc:odbc:bookstore";
//加载驱动程序
//建立连接
Connection conn= DriverManager.getConnection(url);
//创建语句对象
Statement stmt=conn.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
ResultSet
rs=stmt.executeQuery("update books set id='"+id+"', name='"+name+"',title='"+title+"',price="+price+",yr="+yr+",description='"+description+"',saleAmount="+saleAmount+" where id='"+id+"'");
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -