delete_form.jsp~1~
上传用户:top0756
上传日期:2022-08-11
资源大小:6501k
文件大小:1k
源码类别:

Jsp/Servlet

开发平台:

VBScript

  1. <%@ page contentType="text/html; charset=GBK" %>
  2. <%@page import="java.sql.*"%>
  3. <html>
  4. <head>
  5. <title>
  6. delete_form
  7. </title>
  8. </head>
  9. <body background="img/bgg.jpg">
  10.   <%
  11. Connection conn = null;
  12. Statement stmt = null;
  13. ResultSet rs = null;
  14. try{
  15. Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  16. }
  17. catch(ClassNotFoundException ce){
  18. out.println(ce.getMessage());
  19. }
  20. request.setCharacterEncoding("GBK");
  21. String str = request.getParameter("keywords");
  22. if( str == null)
  23. str = "";
  24.       else
  25. try{
  26. conn=DriverManager.getConnection("jdbc:odbc:dsn069");
  27. stmt=conn.createStatement();
  28. rs=stmt.executeQuery("DELETE FROM Infor WHERE name LIKE '%" + str + "%'");
  29. }
  30. catch(SQLException e){
  31. System.out.println(e.getMessage());
  32. }
  33. finally{
  34. stmt.close();
  35. conn.close();
  36. }
  37. %>
  38. <script language="JavaScript">
  39.          alert("删除成功");
  40.          location.href='delete.jsp'
  41.                  </script>
  42. </body>
  43. </html>