下面是我根据文章更新的语句修改的,不知道有没有错啊,如果数据库中有几个管理员的帐号和密码,它会不会默认删除第一个啊,如果是这样的话该怎么修改啊???很急啊,请高手门帮忙啊!!! <!-- #include file="conn.asp" --> <!-- #include file="check.asp" --> <%if chk="1" then response.Redirect("login.asp?name=yes") elseif chk="2" then response.Redirect("login.asp?pass=yes") else%>
<head>
<link href="other/a.css" rel="stylesheet" type="text/css"> <style type="text/css"> <!-- .unnamed1 { border: 1px solid #006699; } --> </style> <%if request("type")="" then%> <%dim sql,rs sql="select * from [admin]" set rs=conn.execute(sql)%> <form name="form1" method="post" action="del.asp?type=del"> </head>
<table width="346" border="0" align="center" cellpadding="0" cellspacing="0" class="unnamed1"> <tr> <td height="20" colspan="2" bgcolor="#006699"> <div align="center" class="b">删除管理员</div></td> </tr> <tr> <td width="76" height="25"> 用户名:</td> <td width="268" height="25"> <input name="user" type="text" id="user" value="<%=rs("admin")%>"> </td> </tr> <tr> <td height="25"> 密码:</td> <td height="25"> <input name="pass" type="password" id="pass" value="<%=rs("adminpass")%>"></td> </tr> <tr> <td height="25"> </td> <td height="25"> <input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置"></td> </tr> </table> </form> <%end if if request("type")="del" then dim sql2,rs2 set rs2=server.createobject("adodb.recordset") sql2="select * from [admin]" rs2.open sql2,conn,1,3 rs2.delete //这里还要不要加上from语句啊?? rs2("admin")=request.form("user") rs2("adminpass")=request.form("pass") rs2.update rs2.close set rs2=nothing response.write("<div align=center>删除管理员成功,<a href=sort.asp>返回</a></div>") end if%>
<%end if %>