用了include后为什么不能正常分页?

girlloveasp 2004-01-15 07:36:29
http://www.jlstm.com/pages/products_dk.asp
这里执行页面,为什么在图片显示部分不能显示出图片?是那里错了。
详细代码如下。

products_dk.asp

<!--#include file="dbconn.asp"-->
<%
dim rs
MaxPerPage=3
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from products_dk order by products_id desc"
rs.open sql,conn,1,1

if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 info</p>"
else
totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
'showpage totalput,MaxPerPage,"sanwei.asp"
showContent
showpage totalput,MaxPerPage,"products_dk.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
'showpage totalput,MaxPerPage,"sanwei.asp"
showContent
showpage totalput,MaxPerPage,"products_dk.asp"
else
currentPage=1
'showpage totalput,MaxPerPage,"sanwei.asp"
showContent
showpage totalput,MaxPerPage,"products_dk.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showContent
dim i
i=0
%>
<%do while not rs.eof%>
<table width="100" border="0">
<tr>
<td></td>
</tr>
</table>
<table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolorlight="#336699" bordercolordark=white>
<tr>
<td width="14%"><font color="#0000FF">产品名称</font></td>
<td width="19%"><a href="javascript:popwin(<%=rs("products_id")%>)"><%=rs("products_name")%></a></td>
<td width="17%"><font color="#0000FF">外型尺寸</font></td>
<td width="21%"><%=rs("products_size")%></td>
<td width="10%"><font color="#0000FF">发布日期</font></td>
<td width="19%"><%=rs("Date_issued")%></td>
</tr>
<tr>
<td colspan="2"><img src="imageout_dk.asp?products_id=<%=id%>" width="150" height="150"></td>
<td colspan="4"><%=rs("products_cent")%></td>
</tr>
</table>
<% i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<%
end sub

function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<form method=Post action="&filename&">"
if CurrentPage<2 then
response.write "<font color='#000080'>首页 上一张</font> "
else
response.write "<a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="¤tPage-1&">上一张</a> "
end if
if n-currentpage<1 then
response.write "<font color='#000080'>下一张 尾页</font>"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
response.write "下一张</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write "<font color='#000080'> 页次:</font><strong><font color=red>"¤tPage&"</font><font color='#000080'>/"&n&"</strong>页</font> "
response.write "<font color='#000080'> 共<b>"&totalnumber&"</b>张图片 <b>"&maxperpage&"</b>张图片/页</font> "
response.write " <font color='#000080'>转到:</font><input type='text' name='page' size=4 maxlength=10 class=navLink value="¤tpage&">"

response.write "<input class=form type='submit' value='Goto' name='cndok'></span></p></form>"

end function
%>


imageout_dk.asp

<!--#include file="dbconn.asp"-->
<%
set rs=server.createobject("ADODB.recordset")
strsql="select * from products_dk where products_id=" & request("products_id")
rs.open strsql,conn,1,1
Response.ContentType = "image/*"
Response.BinaryWrite rs("products_pic").getChunk(7500000)
%>

为什么用include加进来个页面后。分页就不能正常显示了?难道用include后就不能分页了吗?
...全文
74 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
girlloveasp 2004-01-16
  • 打赏
  • 举报
回复
不行。按楼上两位的说法做了。还是不行啊。
stefli 2004-01-15
  • 打赏
  • 举报
回复
看的有点晕
不过,如果这样,肯定不会出现这种问题。
<%
do while not rs.eof and rownum<rs.pagesize
%>
内容
<%
rownum=rownum+1
rs.movenext
loop
%>
sinusoid 2004-01-15
  • 打赏
  • 举报
回复
我有时候也遇到过,怪怪的。
试一下,把这段调整到文件的开头部份。
<%
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
rickylyu 2004-01-15
  • 打赏
  • 举报
回复
不可能吧

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧