<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% request.setCharacterEncoding("utf-8"); //设置参数编码格式 String no=request.getParameter("stuNO"); //获取id参数的值 Class.forName("com.mysql.jdbc.Driver").newInstance(); //Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/杜老师数据库","root","123456"); Connection conn=DriverManager.getConnection("jdbc:mysql://www.duzhaojiang.cn:3306/杜老师数据库", "dzj", "6337925"); String deleteSQL = "delete from 学生表_000 where 学号=?"; PreparedStatement pstmt = null; //声明预处理对象 try { pstmt = conn.prepareStatement(deleteSQL); //获得预处理对象并赋值 pstmt.setString(1, no); //设置第一个个参数 pstmt.executeUpdate(); //执行更新 } catch (SQLException e) { e.printStackTrace(); } finally{ //关闭连接、释放资源 pstmt.close(); conn.close(); } response.sendRedirect("StudentShowList_000.jsp"); %>