从网上看了个:点击表单中某字段升序、再点下降序。放到我的代码里去没有反应,请问怎么
<%
if session("Name") = "" then
response.Redirect "Login.asp"
end if
%>
<!--#include file="CONN.ASP"-->
<html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="images/Admin_Style.css">
<head>
<title>管理中心</title>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
<%
rOlderType = trim(request("orderType"))
if rOlderType="" or isNull(rOlderType) then
olderType = "asc"
else
olderType = rOlderType
end if
if olderType="asc" then
olderTypeStr = "desc"
else
olderTypeStr = "asc"
end if
rOlderField = trim(request("olderField"))
if rOlderField="" or isNull(rOlderField) then
olderField = "id"
else
olderField = rOlderField
end if
sql = "select * from user where class="高二3班" order by "&orderField&""&olderType
%>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
<tr align="center" class="topbg">
<td width="50" height="25"><b><a href="">姓名</a></b></td>
<td width="45"><b><a href="">性别</a></b></td>
<td width="30"><b><a href="">政治面貌</a></b></td>
<td width="80"><b><a href="">民族</a></b></td>
</tr>
<%
page=clng(request("page"))
Set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from user where class="高二3班" order by xingming"
rs.Open sql,conn,1,1
if rs.eof and rs.bof then
response.Write("本目录下没有数据记录!")
else
rs.PageSize=25
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page
for j=1 to rs.PageSize
%><tr align="center" class="tdbg" onMouseOver="this.style.background='#CBE0D8'" onMouseOut="this.style.background='#E1F4EE'">
<td width="50" height="23"><%=rs("class")%></td><!--班级 -->
<td width="45" align="left"> <%=rs("xingming")%></td><!--姓名 -->
<td width="30"><%=rs("sex")%></td><!--性别 -->
<td width="80"><%=rs("zzmm")%></td><!--政治面貌 -->
<td width="45"><%=rs("mz")%></td><!--民族 -->
</tr>
<%
rs.movenext
if rs.eof then exit for
next
%>
</table>
</div>
<br>
<table cellpadding="2" cellspacing="1" border="0" width="100%" class="border" align="center" id="table1">
<tr align="right">
<form method="Post" action="test.asp">
<td height="23" class="topbg"><%if Page<2 then
response.write "首页 上一页 "
else
response.write "<a href=test.asp?page=1>首页</a> "
response.write "<a href=test.asp?page=" & Page-1 & ">上一页</a> "
end if
if rs.pagecount-page<1 then
response.write "下一页 尾页"
else
response.write "<a href=test.asp?page=" & (page+1) & ">"
response.write "下一页</a> <a href=test.asp?page="&rs.pagecount&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&Page&"</font>/"&rs.pagecount&"</strong>页 "
response.write " 共<b><font color='#FF0000'>"&rs.recordcount&"</font></b>条记录 <b>"&rs.pagesize&"</b>条记录/页"
response.write " 转到:<input type='text' name='page' size=4 maxlength=10 class=input value="&page&">"
response.write " <input class=input type='submit' value=' Goto ' name='cndok'></span>"
%> </td>
</form>
</tr>
</table>
</body>
<%
end if
rs.close
set rs=nothing
%>
</html>