日期:2014-05-18  浏览次数:20710 次

更新数据问题??
为什么这不能更新数据呢,而是向数据库里添加数据呢??

<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   import= "java.sql.* "   errorPage= " "   %>
<%@   include   file= "banner.jsp "   %>
<%  
String   accout=request.getParameter( "accout ");
String   phone=request.getParameter( "phone ");
String   esn=request.getParameter( "esn ");
String   imsi=request.getParameter( "imsi ");
String   sid=request.getParameter( "sid ");
String   nid=request.getParameter( "nid ");
%>
<%@   include   file= "conn.jsp "   %>
<%  
String   sql= "update   base_info   set   accout= ' "+accout+ " ',phone= ' "+phone+ " ',esn= ' "+esn+ " ',imsi= ' "+imsi+ " ',sid= ' "+sid+ " ',nid= ' "+nid+ " ' ";
statement.executeUpdate(sql);  

    statement.close()   ;
    connection.close()   ;
%>

------解决方案--------------------
少了
应该update ...set...where...
没有where,数据库不知道你要更新哪个记录