晕倒, 太简单了, 我想复杂了,flyforever81告诉他吧
有办法,在test表中加一个字段user_state(数字型,默认为0)
<!--#include file="conn.asp"-->
<%if session("admin")="1" then
exec="select * from test where id="&request.form("id")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3
rs("aa")=request.form("aa")
rs("cc")=request.form("cc")
rs("bb")=request.form("bb")
rs.update
else
exec="select * from test where id='"&request.form("id")&"'" and user_state=0 "
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3
if rs.eof then
rs("aa")=request.form("aa")
rs("cc")=request.form("cc")
rs("bb")=request.form("bb")
rs("user_state")=1
end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
response.redirect "list.asp"
<!--#include file="conn.asp"-->
<%if session("admin")="1" then
exec="select * from test where id="&request.form("id")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3
rs("aa")=request.form("aa")
rs("cc")=request.form("cc")
rs("bb")=request.form("bb")
rs.update
else
exec="select * from test where id='"&request.form("id")&"'" and user_state=0 "
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3
if rs.eof then
rs("aa")=request.form("aa")
rs("cc")=request.form("cc")
rs("bb")=request.form("bb")
rs("user_state")=1
rs.update
end if
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
response.redirect "list.asp"