ASP修改记录不成功
<!--#includefile="main.asp"--><%user=request("user")pass=request("password")colxrsex=...
<!--#include file="main.asp"-->
<%
user=request("user")
pass=request("password")
colxrsex=request("sex")
coname=request("name")
mail=request("mail")
cotel=request("tel")
cofax=request("fax")
comobi=request("mobi")
company=request("company")
coaddress=request("add")
if request("action")="edit1" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from linadmin where lin_id="&request("id")
rs.open sql,conn,1,3
rs("lin_user")=user
rs("lin_password")=pass
rs("lin_sex")=colxrsex
rs("lin_name")=coname
rs("lin_comadd")=coaddress
rs("lin_tel")=cotel
rs("lin_fax")=cofax
rs("lin_email")=mail
rs("lin_mobi")=comobi
rs("lin_company")=company
rs.update
rs.close
response.write"<script>alert('操作成功');window.open('index_cn.asp','_self')</script>"
response.end
end if
%>
程序都没有错的。值也可以传过来,也可以赋值到rs(...)中,奇怪的就是保存不了。
数据库没问题,因为添加记录都可以。
rs.open sql,conn,3,3这个也不行的。
程序文件夹的读取/修改/写入权限指的是什么??可是添加删除都可以。 展开
<%
user=request("user")
pass=request("password")
colxrsex=request("sex")
coname=request("name")
mail=request("mail")
cotel=request("tel")
cofax=request("fax")
comobi=request("mobi")
company=request("company")
coaddress=request("add")
if request("action")="edit1" then
set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from linadmin where lin_id="&request("id")
rs.open sql,conn,1,3
rs("lin_user")=user
rs("lin_password")=pass
rs("lin_sex")=colxrsex
rs("lin_name")=coname
rs("lin_comadd")=coaddress
rs("lin_tel")=cotel
rs("lin_fax")=cofax
rs("lin_email")=mail
rs("lin_mobi")=comobi
rs("lin_company")=company
rs.update
rs.close
response.write"<script>alert('操作成功');window.open('index_cn.asp','_self')</script>"
response.end
end if
%>
程序都没有错的。值也可以传过来,也可以赋值到rs(...)中,奇怪的就是保存不了。
数据库没问题,因为添加记录都可以。
rs.open sql,conn,3,3这个也不行的。
程序文件夹的读取/修改/写入权限指的是什么??可是添加删除都可以。 展开
3个回答
展开全部
发生这种问题通常是ado版本的问题
采用rs.update的方法有些ado版本支持的不是很好
建议你用sql语句中的update语句。
代码帮你写了
if request("action")="edit1" then
sql = "update linadmin set " & _
"lin_user='" & user & "'," & _
"lin_password='" & pass & "'," & _
"lin_sex='" & colxrsex & "'," _
"lin_name='" & coname & "'," _
"lin_comadd='" & coaddress & "'," _
"lin_tel='" & cotel & "'," _
"lin_fax='" & cofax & "'," _
"lin_email='" & mail & "'," _
"lin_mobi='" & comobi & "'," _
"lin_company='" & company & "'" _
" where lin_id=" & request("id")
conn.execute(sql)
end if
采用rs.update的方法有些ado版本支持的不是很好
建议你用sql语句中的update语句。
代码帮你写了
if request("action")="edit1" then
sql = "update linadmin set " & _
"lin_user='" & user & "'," & _
"lin_password='" & pass & "'," & _
"lin_sex='" & colxrsex & "'," _
"lin_name='" & coname & "'," _
"lin_comadd='" & coaddress & "'," _
"lin_tel='" & cotel & "'," _
"lin_fax='" & cofax & "'," _
"lin_email='" & mail & "'," _
"lin_mobi='" & comobi & "'," _
"lin_company='" & company & "'" _
" where lin_id=" & request("id")
conn.execute(sql)
end if
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询