当前位置: 代码迷 >> Java Web开发 >> 做毕业设计遇到的数据库删除有关问题
  详细解决方案

做毕业设计遇到的数据库删除有关问题

热度:70   发布时间:2016-04-17 14:42:20.0
做毕业设计遇到的数据库删除问题
请高手请教,我查了好多书上的例子,运行后都有同样的错误.    
 
错误是:只会显示第一条数据记录,后面就发生了SQL异常.    
我知道错误就在那个"删除"操作的地址连接上,但是不知道怎么改,也不知道错误究竟是什么.我在下面我贴的例子里标出来,麻烦哪位大侠给我看一下.    
 
谢谢    
 
<%@page     contentType= "text/html;     charset=gb2312 "     language= "java "     import= "java.sql.* "     errorPage= " "%>    
<html>    
      <head>    
              <meta     http-equiv= "Content-Type "     content= "text/html;     charset=gb2312 ">    
      <link     href= "css/style.css "     type= "text/css "     rel= "stylesheet ">    
                 
         
      <%    
              Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");    
          Connection     connection;    
          Statement     s;    
              ResultSet     rs;    
              connection=DriverManager.getConnection( "jdbc:odbc:testDB ", "sa ", "513278 ");    
              s=connection.createStatement();    
              boolean     flag     =     false;    
              if     (request.getParameter( "id ")     !=     null)     {    
                      String     id     =     request.getParameter( "id ");    
                      String     sql     =     "delete     from     tb_userOperation     where     id= ' "     +     id     +     " ' ";    
                      if     (s.executeUpdate(sql)!=0)     {    
                              flag     =     true;    
                      }    
              }    
      %>    
              <title> 删除指定记录 </title>    
</head>    
      <body>    
      <table     width= "500 "     height= "395 "     border= "0 "     cellpadding= "0 "     cellspacing= "0 "     align= "center ">    
                      <tr>    
  相关解决方案