相信这几段程序都是很简单的,我日前是只有这个水平。这里有三个文件,一个是列表,一个是删除数据,另一个是修改数据,但是删除数据总是超时,修改数据根本就读不出要修改的数据来。
文件一:hy.asp
<!-- #include file=conn.asp -->
<%
command="select * from t_user"
Set rs=conn.Execute(command,recordsAffected,adcmd)
if session("level")<2 then
response.write "对不起,你没有此权限"
response.write "<a href=index.asp>返回首页</a>"
else
response.write "<form method=post action=del.asp>"
response.write "<table border=1 align=center>"
response.write "<caption>会员管理</caption>"
response.write "<tr><td>编号</td><td>用户名</td><td>密码</td><td>权限</td><td>用户姓名
</td><td>用户性别</td><td>用户简介</td><td>删除</td></tr>"
while not rs.eof
response.write "<tr>"
for i=0 to rs.fields.count-1
response.write"<td>"&rs.fields(i).value&"</td>"
next
response.write"<td><input type=checkbox name=del value="&rs("d_user")&"></td>"
response.write"<td><a href='qx.asp? editid="&rs("d_user")&"'>修改权限</a></td>"
response.write"</tr>"
rs.movenext
wend
response.write"<tr align=center><td colspan=8><input type=submit value=提交><input
type=reset value=重置></td></tr>"
response.write"</table>"
end if
Set conn=nothing
%>
文件二:del.asp
<!-- #include file=conn.asp -->
<%
set rs=server.createobject("ADODB.Recordset")
sql="select * from t_user"
rs.open sql,conn,adopenkeyset,adlockoptimistic,adcmdtext
decount=Request.form("del").count
if decount=0 then Response.Redirect "hy.asp"
While not rs.eof
for i=1 to decount
if request.form("del")(i)=cstr(rs("d_user")) then
rs.delete
rs.update
exit for
end if
next
rs.movenext
wend
rs.close
set conn=nothing
%>
文件三:qx.asp
<!-- #include file=conn.asp -->
<%
u=request("editid")
set rs=server.createobject("ADODB.Recordset")
rs.open "'select * from t_user where d_user="&u&"',conn,adopenkeyset,adlockoptimistic"
if session("level")<2 then
response.write "你没有足够的权限进行此操作"
response.write "<a href=index.asp>返回首页</a>"
else
response.write "<form method=post action=xg.asp>"
response.write "<table align=center border=1>"
response.write "<caption>修改权限</caption>"
response.write "<tr><td>用户名</td><td>"&u&"</td></tr>"
response.write "<tr><td>权限</td><td><select name=qx>"
response.write "<option value=1>1</option>"
response.write "<option value=2>2</option>"
response.write "</select></td></tr>"
response.write "<tr><td colspan=2><input type=submit value=确认修改><input type=reset value=重置></td></tr></table>"
end if
%>