<%
        String id1=request.getParameter("id");   //肯定能获取到
        
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        String mypath=request.getRealPath("/"); //获取网站根目录路径
        String url="jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ="+mypath+"data/database.mdb"; 
        Connection con=DriverManager.getConnection(url);
        Statement stmt=con.createStatement();
        String shanchu="DELETE FROM liuyanbiao WHERE 编号="+id1;
        ResultSet rs=stmt.executeQuery(shanchu);
        while (rs.next()) {
         out.print("删除成功!");
                             }
           con.close(); %>
  帮忙解决一下,红色的地方,老是出错

解决方案 »

  1.   

    你用executeQuery当然会出错了,你是要执行删除操作哎
    改成用executUpdate就ok了
      

  2.   

    报什么错。改为:看看 
    stmt.executeUpdate(shanchu); 
      

  3.   

    org.apache.jasper.JasperException: Unable to compile class for JSP: 报的错An error occurred at line: 21 in the jsp file: /other/shanchu.jsp
    The method executUpdate(String) is undefined for the type Statement
    18:         Connection con=DriverManager.getConnection(url);
    19:         Statement stmt=con.createStatement();
    20:  String shanchu="DELETE FROM liuyanbiao WHERE 编号="+id1;
    21:  ResultSet rs=stmt.executUpdate(shanchu);
    22:    while (rs.next()) {
    23:      out.print("删除成功!");
    24:                              }
      

  4.   


    String id1 = request.getParameter("id");  //肯定能获取到Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String mypath = request.getRealPath("/data/database.mdb"); //获取网站根目录路径 
    String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=" + mypath; Connection con=DriverManager.getConnection(url); 
    Statement stmt = con.createStatement(); String shanchu="DELETE FROM liuyanbiao WHERE 编号=" + id1;stmt.executeQuery(shanchu); stmt.close();
    con.close();
           out.print("删除成功!");你把
    stmt.executeUpdate(shanchu)
    写成
    stmt.executUpdate(shanchu)