标题:对数据库修改的问题
取消只看楼主
chenxingg
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2006-1-5
结帖率:0
 问题点数:0 回复次数:4 
对数据库修改的问题
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from [user] where userid="&userid,conn,1,3
if trim(request.form("UserPassword"))<>"" then rs("UserPassword")=md5(trim(request.form("UserPassword")))
rs("realname")=trim(request.form("realname"))
rs("identify")=trim(request.form("identify"))
rs("UserMobile")=trim(request.form("UserMobile"))
rs("userqq")=trim(request.form("userqq"))
rs("MSN")=trim(request.form("MSN"))
rs("useremail")=trim(request.form("useremail"))
rs("UserQuestion")=trim(request.form("UserQuestion"))
if trim(request.form("UserAnswer"))<>"" then rs("UserAnswer")=md5(trim(request.form("UserAnswer")))
rs("UserSex")=request.form("UserSex")
rs("city")=trim(request.form("city"))
rs("address")=trim(request.form("address"))
rs("postcode")=trim(request.form("postcode"))
rs("usertel")=trim(request.form("usertel"))
rs("score")=trim(request.form("score"))
rs("deposit")=trim(request.form("deposit"))
rs("GrpID")=trim(request.form("GrpID"))
rs("book")=trim(request.form("book"))
rs.Update
rs.Close
set rs=nothing
response.Write "<script language=javascript>alert('操作成功!');history.go(-1);</script>"


为什么显示操作成功,但是数据并没有被更改呢?
搜索更多相关主题的帖子: quot form 数据库 trim request 
2007-05-25 10:21
chenxingg
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2006-1-5
得分:0 
我用的
access的

并且前面还有<%dim userid,rsUser,UserNum
userid=SafeRequest("id",1)
set rs=server.createobject("adodb.recordset")
rs.open "select * from [user] where userid="&userid ,conn,1,1
%>

为什么参数没有传递呢?


淘服网www.
2007-05-28 12:17
chenxingg
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2006-1-5
得分:0 

淘服网www.
2007-05-29 09:04
chenxingg
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2006-1-5
得分:0 

<form name="form1" method="post" action="saveuser.asp?action=save&id=<%=userid%>">
<td valign="top" bgcolor="#FFFFFF"> <br>
<table width="95%" border="2" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
<tr bgcolor="#FFFFFF">
<td width="20%" height="25" align="right" background="images/topbg.gif" bgcolor="#F7F7F7">用户名称:</td>
<td width="80%"><font color=#FF6600><%=trim(rs("username"))%></font></td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="right" background="images/topbg.gif" bgcolor="#F7F7F7">登录密码:</td>
<td>
<input name="UserPassword" type="text" class="input_sr" id="UserPassword" size="30">
不改密码请为空!</td>
............................................................................................

<br>
</td></form>


saveuser.asp



dim userid,action
action=FormatSQL(SafeRequest("action",0))
userid=SafeRequest("id",1)
if userid="" then userid=request.form("userid")
select case action
case "save"
if session("rank")>1 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权编辑用户信息!');history.go(-1);</script>"
response.End
end if

userid=request("userid")
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from user where userid="&userid,conn,1,3
if trim(request.form("UserPassword"))<>"" then rs("UserPassword")=md5(trim(request.form("UserPassword")))
rs("realname")=trim(request.form("realname"))
...............................................
rs.Update
rs.Close
set rs=nothing
response.Write "<script language=javascript>alert('操作成功!');history.go(-1);</script>"
case "del"
if session("rank")>1 then
conn.close
set conn = nothing
response.Write "<script language='javascript'>alert('你无权删除用户!');history.go(-1);</script>"
response.End
end if
conn.execute "delete from [user] where userid in ("&userid&") "
conn.execute "delete from orders where userid in ("&userid&")"
response.Redirect "b2b_user.asp"
end select
%>


淘服网www.
2007-05-29 13:40
chenxingg
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2006-1-5
得分:0 
问题还没有解决



淘服网www.
2007-05-30 09:28



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-142410-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.391268 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved