主题:显示问题,帮忙看一下
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select id,title,laiyuan,content,time,hit,zz from News order by id desc",conn,1,1
if rs.bof and rs.eof then
response.write"暂无信息"
response.end
end if
%>
<%'=============分页定义开始,要放在数据库打开之后
if err.number<>0 then '错误处理
response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then '检测记录集是否为空
r=cint(rs.RecordCount) '记录总数
rowcount = 20 '设置每一页的数据记录数,可根据实际自定义
rs.pagesize = rowcount '分页记录集每页显示记录数
maxpagecount=rs.pagecount '分页页数
page=request.querystring("page")
if page="" then
page=1
end if
rs.absolutepage = page
rcount1=0
pagestart=page-9
pageend=page+9
if pagestart<1 then
pagestart=1
end if
if pageend>maxpagecount then
pageend=maxpagecount
end if
rcount=rs.RecordCount
'=============分页定义结束%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<%'===========循环体开始
do while not rs.eof and rowcount%>
<table width="700" border="0" align="center" cellpadding="2" cellspacing="1">
<tr <%if icolor=0 then response.write"bgColor=#FFFAFC" else response.write"bgColor=#ffffff" end if%>>
<td width="85%"><div align="left"> · <a href=/news.asp?newsid=<%=rs("id")%> target="_blank" title="作者:<%=rs("zz")%>--|--来源:<%=rs("laiyuan")%>--|--<%=left(rs("title"),60)%><% if len(rs("title"))>=60 then%> …<%end if%>">
<%=left(rs("title"),50)%>
<% if len(rs("title"))>=50 then%>
…
<%end if%>
</a></div></td>
<td width="15%"><%=formatdatetime(rs("time"),2)%></td>
</tr>
</table>
<%
rowcount=rowcount-1
rs.movenext
icolor=icolor+1
if icolor>1 then icolor=0
loop
end if
end if
'===========循环体结束%>
</td>
</tr>
</table>
<%'===========显示分页的过程调用,要放在数据库打开后、释放资源前
call listPages()
rs.close '释放资源
set rs=nothing%>
<%'==========分页过程开始,也可单独创建一文件在本文件前包含调用
sub listPages() '定义过程开始%>
</td>
</tr>
<tr align="left">
<td bgcolor=#E4E4E4 >
<%if pagestart=1 then%>
<FONT face=webdings><span style="color: #FF0000"> 9</span></font>
<%else%>
<a href=abc.asp?page=1&lm="&lm&" title="首页"><FONT
face=webdings><span >9</span></font></a>
<%end if%>
<% for i=pagestart to pageend
if i=0 then
i=1
end if
strurl="<a href=abc.asp?page="&i&"&lm="&lm&" title='到"&i&"页'>"&i&"</a>"
response.write strurl
response.write " "
next
%>
<%if pageend=maxpagecount then%>
<FONT
face=webdings><span style="color: #FF0000">:</span></font>
<%else%>
<a href=abc.asp?page=<%=maxpagecount%>&lm="&lm&" title="尾页"><FONT
face=webdings><span >:</span></font></a>
<%end if%>
页次:<font color=red><%=page%></font>/<%=maxpagecount%>页
</table>
<%end sub '定义过程结束
'==========分页过程结束%>
当没有数据时,这段分页代码后面的所有内容都不显示了,是怎么回事,当有数据时,显示正常
如果不明白,打个比方:就像本站一样,如果有数据下端的联系方式等显示正常,如果没有数据时,提示 “暂无信息” 后面什么都没有了
set rs=server.CreateObject("adodb.recordset")
rs.open "select id,title,laiyuan,content,time,hit,zz from News order by id desc",conn,1,1
if rs.bof and rs.eof then
response.write"暂无信息"
response.end
end if
%>
<%'=============分页定义开始,要放在数据库打开之后
if err.number<>0 then '错误处理
response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then '检测记录集是否为空
r=cint(rs.RecordCount) '记录总数
rowcount = 20 '设置每一页的数据记录数,可根据实际自定义
rs.pagesize = rowcount '分页记录集每页显示记录数
maxpagecount=rs.pagecount '分页页数
page=request.querystring("page")
if page="" then
page=1
end if
rs.absolutepage = page
rcount1=0
pagestart=page-9
pageend=page+9
if pagestart<1 then
pagestart=1
end if
if pageend>maxpagecount then
pageend=maxpagecount
end if
rcount=rs.RecordCount
'=============分页定义结束%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<%'===========循环体开始
do while not rs.eof and rowcount%>
<table width="700" border="0" align="center" cellpadding="2" cellspacing="1">
<tr <%if icolor=0 then response.write"bgColor=#FFFAFC" else response.write"bgColor=#ffffff" end if%>>
<td width="85%"><div align="left"> · <a href=/news.asp?newsid=<%=rs("id")%> target="_blank" title="作者:<%=rs("zz")%>--|--来源:<%=rs("laiyuan")%>--|--<%=left(rs("title"),60)%><% if len(rs("title"))>=60 then%> …<%end if%>">
<%=left(rs("title"),50)%>
<% if len(rs("title"))>=50 then%>
…
<%end if%>
</a></div></td>
<td width="15%"><%=formatdatetime(rs("time"),2)%></td>
</tr>
</table>
<%
rowcount=rowcount-1
rs.movenext
icolor=icolor+1
if icolor>1 then icolor=0
loop
end if
end if
'===========循环体结束%>
</td>
</tr>
</table>
<%'===========显示分页的过程调用,要放在数据库打开后、释放资源前
call listPages()
rs.close '释放资源
set rs=nothing%>
<%'==========分页过程开始,也可单独创建一文件在本文件前包含调用
sub listPages() '定义过程开始%>
</td>
</tr>
<tr align="left">
<td bgcolor=#E4E4E4 >
<%if pagestart=1 then%>
<FONT face=webdings><span style="color: #FF0000"> 9</span></font>
<%else%>
<a href=abc.asp?page=1&lm="&lm&" title="首页"><FONT
face=webdings><span >9</span></font></a>
<%end if%>
<% for i=pagestart to pageend
if i=0 then
i=1
end if
strurl="<a href=abc.asp?page="&i&"&lm="&lm&" title='到"&i&"页'>"&i&"</a>"
response.write strurl
response.write " "
next
%>
<%if pageend=maxpagecount then%>
<FONT
face=webdings><span style="color: #FF0000">:</span></font>
<%else%>
<a href=abc.asp?page=<%=maxpagecount%>&lm="&lm&" title="尾页"><FONT
face=webdings><span >:</span></font></a>
<%end if%>
页次:<font color=red><%=page%></font>/<%=maxpagecount%>页
</table>
<%end sub '定义过程结束
'==========分页过程结束%>
当没有数据时,这段分页代码后面的所有内容都不显示了,是怎么回事,当有数据时,显示正常
如果不明白,打个比方:就像本站一样,如果有数据下端的联系方式等显示正常,如果没有数据时,提示 “暂无信息” 后面什么都没有了