?? update2.java
字號(hào):
/************************ Update.java *********************/import java.io.*;import java.sql.*;import javax.servlet.*;import javax.servlet.http.*;public class Update extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String idStr, title, author, priceStr; idStr=req.getParameter("id"); title=req.getParameter("title"); author=req.getParameter("author"); priceStr=req.getParameter("price"); int id=Integer.parseInt(idStr); float price=new Float(priceStr).floatValue(); String sql="UPDATE bookTbl SET " + "bookId=" + idStr + ", bookTitle=" + title + ", bookAuthor=" + author + ", bookPrice=" + priceStr + " WHERE bookId=" + id + ";" ; // Connection con = null; Statement statement = null; ResultSet rs = null; res.setContentType("text/html"); ServletOutputStream sos=res.getOutputStream(); PrintWriter pw=new PrintWriter(sos,true); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection("jdbc:odbc:bookdb"); statement = con.createStatement(); rs = statement.executeQuery(sql); // pw.println("<HTML>"); pw.println("<HEAD>"); pw.println("<TITLE>insert</TITLE>"); pw.println("<BASE HREF=/ TARGET=showFrame>"); pw.println("</HEAD>"); pw.println("<BODY>"); pw.println("<H2>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -