<%@ page language="java" import="java.util.*" pageEncoding="GB2312"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <body> <form action="" method="post"> 产品号:<input type="text" name="number"> <input type="button" value="删除"> </form> <% String number = request.getParameter("number"); if(number != null && !"".equals(number)){ Connection con; Statement sql; ResultSet rs; try{ Class.forName("com.mysql.jdbc.Driver"); }catch(Exception e){ } try{ String uri = "jdbc:mysql://127.0.0.1:3306/warehouse"; String user = "root"; String password = ""; con = DriverManager.getConnection(uri, user, password); //也可以写成con=DriverManager.getConnection(uri+"?user=root&password="); sql = con.createStatement(); rs = sql.executeQuery("DELETE * FROM product where number='" + number + "'"); con.close(); } } %> </body></html>
添加回答
举报
0/150
提交
取消