⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stud_manage.asp

📁 本人的课程设计。不足之处请大家指教。因为第一次用ASP有很多不足的地方。
💻 ASP
字号:
<!-- #include file="cookies.asp" -->
<!-- #include file="conn/conn.asp" -->
<html>
<head>
<title>用户管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#EEEEEE" text="#000000">
<div align="center">
<!-- #include file="button_t.asp" -->
</div>
<table width="760" border="0" align="center" bgcolor="#FFFFFF">
	  <form name="form1" method="post" action="stud_manage.asp">
  <tr>
    <td>
		<font color="#0000FF">用户分类: 

		  <select name="lev" id="lev">
		  <option value="">所有用户</option>
		  <option value="1">学生</option>
		  <option value="2">老师</option>
		  <option value="3">管理员</option>
		  </select>
		  <input type="hidden" name="type" value="fl">
		  &nbsp;
		 班级:<input type="text" name="class"  size="10" maxlength="10">	
		 &nbsp;	
		 姓名:<input type="text" name="name" size="20" maxlength="20">
		 &nbsp;
		<input type="submit" name="Submit2" value="查询"> </font>
	  <hr width="760">
     </td>
	 </tr>
	  </form>
	 <tr>
	 <td>
	  <form name="form2" method="post" action="stud_del.asp">
		<div align="right">编辑修改后请刷新</div>
        <table width="750" border="0" align="center" bgcolor="#CCCCCC">
          <tr> 
            <td width="80"> 
              <div align="center">用户名</div>
            </td>
            <td width="100"> 
              <div align="center">姓名</div>
            </td>
            <td width="100"> 
              <div align="center">学号</div>
            </td>
            <td width="120">
              <div align="center">班级</div>
            </td>
            <td width="120"> 
              <div align="center">性别</div>
            </td>
            <td width="100"> 
              <div align="center">问题</div>
            </td>
            <td width="50"> 
              <div align="center">答案</div>
            </td>
            <td width="50"> 
              <div align="center">级别</div>
            </td>
            <td width="50"> 
              <div align="center">删除</div>
            </td>
            <td>&nbsp;</td>
          </tr>
          <%
	'以下分页显示用户信息列表
	uname=trim(request.form("name"))
	uclass=trim(request.form("class"))
	lev=trim(request.form("lev"))
	
	if request("page")="" then
	page="1"
	else 
	page=request("page")
	end if
	set rs=server.createobject("adodb.recordset")
	if lev="" then
	   if uclass="" then 
	   		if uname="" then
				sql="select * from student order by id desc"			
			else
				sql="select * from student where name='"&trim(uname)&"' order by id desc"
			end if
	   else
	   		if uname="" then
				sql="select * from student where class='"&trim(uclass)&"' order by id desc"
			else
				sql="select * from student where name='"&trim(uname)&"' and class='"&trim(uclass)&"' order by id desc"
			end if	   
	   end if 
	else
	   if uclass="" then 
	   		if uname="" then
				sql="select * from student where lev='"&trim(lev)&"' order by id desc"
			else
				sql="select * from student where name='"&trim(uname)&"' and lev='"&trim(lev)&"' order by id desc"
			end if
	   else
	   		if uname="" then
				sql="select * from student where class='"&trim(uclass)&"' and lev='"&trim(lev)&"' order by id desc"
			else
				sql="select * from student where name='"&trim(uname)&"' and class='"&trim(uclass)&"' and lev='"&trim(lev)&"' order by id desc"
			end if	   
	   end if 
	end if
	rs.open sql,conn,1,1
	if not rs.eof then
		rs.pagesize=30
        rs.Absolutepage=clng(page)
	    if cstr(page)=cstr(rs.PageCount) and (rs.RecordCount mod rs.PageSize <> 0) then                      
 	    recend=rs.RecordCount mod  rs.PageSize                      
	     else                       
	     recend=rs.PageSize                      
	    end if 
		if request("page")<>"" then
		if fix(trim(request("page")))>rs.pagecount then
		response.redirect "stud_manage.asp?page="&(request("page")-1)
		end if
		end if
	    for i=1 to recend
		 if i mod 2=1 then	'动态显示颜色
		 color="#f8f8f8"
		 else
		 color="#E4e4e4"
		 end if
	%>
          <tr bgcolor="<%=color%>"> 
            <td width="80"><%=trim(rs("id"))%></td>
            <td width="100"><%=trim(rs("name"))%></td>
            <td width="100"><%=trim(rs("cid"))%></td>
            <td width="120"><%=trim(rs("class"))%></td>
            <td width="120"><%=trim(rs("sex"))%></td>
            <td width="100"><%=trim(rs("question"))%></td>
			<td width="100"><%=trim(rs("answer"))%></td>
			<%if trim(rs("lev"))=1 then%>
			<td width="100">学生</td>
			<%elseif trim(rs("lev"))=2 then%>
			<td width="100">老师</td>
			<%else%>
			<td width="100">管理员</td>
			<%end if%>
            <td width="50"> 
              <div align="center"> 
			  <%if trim(rs("lev"))<>3 then%>
                <input type="checkbox" name="id" value="<%=trim(rs("id"))%>">
			  <%end if%>
              </div>
            </td>
            <td> 
              <input type="button" name="Submit4" value="编辑" onclick="window.open('stud_edit.asp?id=<%=trim(rs("id"))%>','intr','menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=1,resizable=0,width=530,height=500,top=80,left=100');return false;">
            </td>
          </tr>
          <%
	rs.movenext
	next
	%>
          <tr> 
            <td width="80">&nbsp;</td>
            <td width="100">&nbsp;</td>
            <td width="100">&nbsp;</td>
            <td width="120">&nbsp;</td>
            <td width="120">&nbsp;</td>
            <td width="100">&nbsp;</td>
            <td width="120">&nbsp;</td>
            <td width="100">&nbsp;</td>
            <td width="50"> 
              <div align="center"> 
                <input type="submit" name="Submit3" value="删除">
              </div>
            </td>
            <td>&nbsp;</td>
          </tr>
        </table>
      </form>
      <table border="0" width="750" align="center" bgcolor="<%=tablebgcolor_2%>">
        <tr> 
          <td> 
            <div align="left"><font color="#000000">共有考生记录<%=rs.recordcount%>条,每页30个,目前<%=page%>/<%=rs.pagecount%>页</font></div>
          </td>
          <td width="40" align="center"> <font color="#000000"> 
            <% if page="1" then %>
            首页 
            <%else%>
            <a href=stud_manage.asp?t=students>首页</a> 
            <% end if %>
            </font></td>
          <td width="40" align="center"> <font color="#000000"> 
            <% if page="1" then %>
            上页 
            <%else%>
            <a href=stud_manage.asp?page=<%=page-1%>&t=students>上页</a> 
            <% end if %>
            </font></td>
          <td width="40" align="center"> <font color="#000000"> 
            <% if page=cstr(rs.pagecount) then %>
            下页 
            <%else%>
            <a href=stud_manage.asp?page=<%=page+1%>&t=students>下页</a> 
            <% end if %>
            </font></td>
          <td width="40" align="center"> <font color="#000000"> 
            <% if cstr(page)-cstr(rs.pagecount)=0 then%>
            尾页 
            <% else %>
            <a href=stud_manage.asp?page=<%=rs.pagecount%>&t=students>尾页</a> 
            <% end if %>
            <%
		else
		response.write "还没有加入考生!"
		end if
		rs.close
        set rs=nothing
		%>
            </font></td>
        </tr>
      </table>
  </td>
  </tr>
</table>
</body>
</html>
<%
conn.close
set conn=nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -