ASP中怎么分页显示数据库里的数据

ASP中怎么分页显示数据库里的数据,第1张

Sub show()
logusername = replace(trim(requestQuerystring("logusername")),"'","")
if logusername <> "" then
sql="select from JB_log where username='"+ logusername +"' order by logid desc"
logpage = "&logusername="& logusername
logtext = "当前显示<font color=red>"& logusername &"</font>的 *** 作日志 | <a href=""logsasp"">显示全部</a>"
else
sql="select from JB_log order by logid desc"
End if
set rs = serverCreateObject("adodbrecordset")
rsopen sql,conn,1,1
%>
<table height="29" border="0" align="center" cellpadding="0" cellspacing="0" class="table-noColor">
<form name="form2" method="Get" action="logsasp"><tr>
<td>输入 *** 作人:
<input name="logusername" type="text" id="logusername" size="16" maxlength="20">
<input type="submit" name="Submit3" value="搜索"> <%=logtext%>
</td>
</tr></form>
</table>
<table border="0" align="center" cellpadding="3" cellspacing="1" class="table">
<form name="form4" method="post" action="logsaspaction=del"><tr>
<td class="table-title"> *** 作人</td>
<td class="table-title"> *** 作时间</td>
<td class="table-title"> *** 作内容/文章作者</td>
<td class="table-title"> *** 作理由/扣分</td>
<td class="table-title" align="center">内容</td>
<td class="table-title"> *** 作时IP</td>
<%
if userID=33 and usergroup=1 then
%>
<td width="15" class="table-title">
</td>
<%
end if
%>
</tr>
<%
if not(rsEof and rsBof) then
page = trim(requestform("page"))
if page = "" then page = trim(requestQueryString("page"))
if Not(IsNumeric(page)) or page = "0" then page = 1
rspageSize = 60
pageCount = rspageCount
if len(page) > 4 then page = pageCount
if Cint(page) > Cint(pageCount) then page = pageCount
rsabsolutepage = page
color2 = 0
for i = 1 to rspagesize
if rseof then exit for
if color2 mod 2 = 0 then
color1 = "Class=""table-dark"""
else
color1 = "Class=""table-light"""
end if
%>
<tr <%=color1%>>
<td><%="<a href=""useraspuserid="&rtrim(rs("userid"))&""" target=""_blank"">"&rtrim(rs("username"))&"</a>"%></td>
<td><%=rtrim(rs("logtime"))%></td>
<td><%=rtrim(rs("logC"))%></td>
<td><%=rtrim(rs("reason"))%></td>
<td align="center"><a href="action=showlog&logid=<%=rs("logid")%>">
<%if trim(rs("oldcontent")) <> "" then responseWrite("查看") end if%>
</a></td>
<td><%=rtrim(rs("logIP"))%></td>
<%
if userID=33 and usergroup=1 then
%>
<td align="center">
<input name="logid" type="checkbox" id="logid" value="<%=trim(rs("logid"))%>">
</td>
<%
End if
%>
</tr>
<%
rsMoveNext
color2=color2+1
Next'i
End if
if userID=33 and usergroup=1 then
%>
<tr align="right" <%=color1%>>
<script language="javascript">
function AllSet(theForm)
{
for(i=0;i<documentform4length;i++)
if(documentform4elements[i]type=="checkbox")
documentform4elements[i]checked=1}

function Reverse()
{
for(i=0;i<documentform4length;i++)
if(documentform4elements[i]type=="checkbox")
if(documentform4elements[i]checked==1)
documentform4elements[i]checked=0
else
documentform4elements[i]checked=1}
function ReSet()
{
for(i=0;i<documentform4length;i++)
if(documentform4elements[i]type=="checkbox")
if(documentform4elements[i]checked==1)
documentform4elements[i]checked=0}
</script>
<td colspan="7">
<input name="button" type=button onclick="AllSet()" value="全选">
<input name="button" type=button onclick="Reverse()" value="反选">
<input name="button" type=button onclick="ReSet()" value="不选">
<input name="Submit" type="submit" id="Submit" value="删除所选"></td>
</tr>
<%
End if
%>
</form>
</table>
<table border="0" align="center" cellpadding="0" cellspacing="0" class="table-noColor">
<tr>
<td>
<%
if pagecount < 1 then pagecount = 1
responseWrite "页次:"& PAGECOUNT &"/" & page &"页 每页"& rspageSize &" 记录"&rsrecordCount&" "
%>
</td>
<td height="30">分页:
<%
beginpage = 1
endpage = CInt(pagecount)
page = CInt(page)
if pagecount >= 9 then
if page >= 5 then
beginpage = page - 4
if page <= (pagecount - 4) then
endpage = page + 4
else
endpage = pagecount
beginpage = pagecount - 4
end if
else
beginpage = 1
endpage = 9
end if
end if
if beginpage>1 then responsewrite " <a title=""第一页"" href=""logsasp"& logpage &"""><font face=webdings>9</font></a>"
for j = beginpage to endpage
if j = page then
responsewrite" <b>[" & j & "]</b> "
else
responsewrite" <a href=""logsasppage=" & j & logpage &""">[" & j & "]</a> "
end if
next
if endpage < pagecount then responsewrite " <a title=""最末页"" href=""logsasppage="& pagecount & logpage &"""><font face=webdings>:</font></a>"
%>
</td>
<form name="form1" method="post" action="">
<td align="right">转到:第
<input name="page" type="text" size="3" maxlength="5">
<input type="submit" name="Submit2" value="页">
</td>
</form>
</tr>
</table>
<%
rsclose
set rs = nothing
End Sub

以上就是关于ASP中怎么分页显示数据库里的数据全部的内容,包括:ASP中怎么分页显示数据库里的数据、、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/9748887.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-01
下一篇 2023-05-01

发表评论

登录后才能评论

评论列表(0条)

保存