📄 userlist.asp
字号:
<!-- #include file="ChkPwd.asp" -->
<!-- #include file="IsAdmin.asp" -->
<html>
<head>
<title>系统用户管理</title>
<script language="JavaScript">
function newwin(url) {
var newwin=window.open(url,"newwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=380");
newwin.focus();
return false;
}
</script>
</head>
<body link="#000080" vlink="#008080">
<h3></h3>
<h2 align="center">用户列表</h2>
<table width='90%' align=center cellspacing=1 cellpadding=2 border=1 bordercolor="#808080" bordercolordark="#FFFFFF" bordercolorlight="#E1F5FF">
<tr>
<td align="center" width='20%' bgcolor="#E1F5FF"><b>用户名</b></td>
<td align="center" width='20%' bgcolor="#E1F5FF"><b>用户姓名</b></td>
<td align="center" width='30%' bgcolor="#E1F5FF"><b>电子邮箱</b></td>
<td align="center" width='30%' bgcolor="#E1F5FF"><b>操 作</b></td>
</tr>
<%
'Server对象的CreateObject方法建立Connection对象
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.ConnectionString="driver={SQL Server};server=Ntserver;UID=sa;PWD=sa;Database=News"
Conn.Open
'定义Recordset对象
Set rs=Server.CreateObject("ADODB.Recordset")
'设置rs的ActiveConnection属性,绑定到连接
Set rs.ActiveConnection = Conn
'设置游标类型
rs.CursorType = 3
'执行SQL语句,读取所有的用户数据,并保存结果到记录集对象rs中
rs.Open "Select * from Users Order by UserId"
rCount = rs.RecordCount
'循环显示所有的用户数据,同时画出表格
Do While Not rs.EOF
%>
<tr>
<td><%=rs("UserName")%></td>
<td><%=rs("Ename")%></td>
<td><%=rs("Email")%></td>
<td align="center"><a href=UserEdit.asp?userid=<%=rs("UserId")%> onclick="return newwin(this.href)">修改</a>
<% If rs("UserName")<>"Admin" Then %>
<a href=UserDelt.asp?userid=<%=rs("UserId")%> onclick="return newwin(this.href)">删除</a> </td>
<% End If %>
</tr>
<%
rs.MoveNext
Loop
If rCount = 0 Then
Response.Write "<tr align='center'><td colspan=6><font color=red>目前还没有用户记录</font></td></tr>"
Else
Response.Write "<tr align='center'><td colspan=6><font color=red>当前共有" & Trim(rCount) &"条用户记录</font></td></tr>"
end if
%>
</table>
<br>
<p align=center><a href=# onclick="return newwin('UserAdd.asp')">添加用户信息</a></p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -