jsp用户修改信息 更新问题
我 之前又给表 用来修改信息,然后点击修改 进入下面的界面,并将信息传递过来,可是为什么我 信息没有更新啊,数据库信息也没有更新,能帮我看看是为什么吗?
<%@page contentType="text/html; charset=gb2312" language="java" import="java.sql.*"
errorPage="" %>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<jsp:useBean id="wu" scope="page" class="wu.jdbc" />
<body>
<%
String login = (String)session.getAttribute("login") ;
if(login==null){
out.println("您不是管理员!不能登陆修改");
}else{
Connection con = wu.getConn() ;
Statement stmt = con.createStatement() ;
String id = request.getParameter("id") ;
String name=request.getParameter("Username");
String Password =request.getParameter("Psd1");
String Company =request.getParameter("Companyname");
String Rname =request.getParameter("Rename");
String Email =request.getParameter("Email");
String Phone =request.getParameter("Phone");
String sql = "update alluser set username='"+name+"',password='"+Password+"',company='"+Company+"',rname='"+Rname+"',email='"+Email+"',phone='"+Phone+"' where id="+id;
int rs=stmt.executeUpdate(sql);
try {
stmt.close();
con.close();
}
catch (Exception ex) {
}
response.sendRedirect("M_user_in.jsp");
}
%>
</body>
</html>
------解决方案--------------------
"update alluser set username='"+name+"',password='"+Password+"',company='"+Company+"',rname='"+Rname+"',email='"+Email+"',phone='"+Phone+"' where id="+id"
sql语句写的不对,好好看下单双引号吧