ASP for循环分页问题
这是我用来循环生成分页的代码,现在的问题是生成的多个页面中内容部分是一样的!是不是RS在读取记录时出现了问题?我实在想不出来了! 请高手帮我看看这段代码?非常感激! 我在线等待~~for page=1 to counts
News_con=""
Set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [product] where isMakeHtml=1 order by proid desc",conn,1,1
rs.PageSize = num
if Not IsEmpty(page) then
if Not IsNumeric(page) then
page=1
else
Page = cint(page)
end if
if Page > rs.PageCount then
rs.AbsolutePage = rs.PageCount
elseif Page <= 0 then
rs.AbsolutePage = 1
else
rs.AbsolutePage = Page
end if
else
rs.AbsolutePage=1
end if
Page = rs.AbsolutePage
News_con=News_con & "<table border=0 cellpadding=0 cellspacing=0 width=730 align=center><tr>"
For i = 1 to rs.PageSize
News_con=News_con & "<td align=center><table border=0 width=335><tr><td align=left height=20 colspan=2><strong><a href='../"&rs("filepath")&"' target='_blank'>"&left(rs("title"),8)&"</a></strong></td></tr>"
News_con=News_con & "<tr valign=top><td align=center><a href='"&rs("filepath")&"' target='_blank'><img src=../pictures/"&rs("smallimg")&" width=130 height=170 border=0></a></td><td style=word-break:break-all; width=205>"
News_con=News_con & "<table border=0 width=205 class=cc><tr valign=top><td height=145>"
if len(rs("content"))>80 then
News_con=News_con & left(rs("content"),80)&"..."
else
News_con=News_con & rs("content")
end if
News_con=News_con &"</td></tr><tr><td align=right height=25><font id=detail><a href='../"&rs("filepath")&"' target='_blank'>详细内容>></a></font></td></tr></table></td></tr>"
News_con=News_con & "<tr><td height=1 colspan=2 background=../images/tiao.jpg></td></tr></table>"
News_con=News_con & "</td><td width=30> </td>"
rs.MoveNext
if rs.eof then exit for
if i mod 2=0 then News_con=News_con & "</tr><tr><td height=8 colspan=6></td></tr><tr>"
NEXT
News_con=News_con & "</tr></table>"
News_con=News_con&"<div align=center class=pageline>"
If page=1 then
News_con=News_con&"[<a Href=../Htmlfile/ProductList_"& 1 &".html>首页</a>]"
News_con=News_con&"[<a Href=../Htmlfile/ProductList_"& 1 &".html>上一页</a>]"
else
News_con=News_con&"[<a Href=../Htmlfile/ProductList_"& 1 &".html>首页</a>]"
News_con=News_con&"[<a Href=../Htmlfile/ProductList_"& page - 1 &".html>上一页</a>]"
end if
if page=rs.pagecount then
News_con=News_con&"[<a Href=../Htmlfile/ProductList_"&rs.PageCount&".html>下一页</a>]"
News_con=News_con&"[<a Href=../Htmlfile/ProductList_"&rs.PageCount&".html>尾页</a>]"
else
News_con=News_con&"[<a Href=../Htmlfile/ProductList_"&page + 1&".html>下一页</a>]"
News_con=News_con&"[<a Href=../Htmlfile/ProductList_"&rs.PageCount&".html>尾页</a>]"
end if
News_con=News_con&"[页次:"&page&"/"&rs.PageCount&"]"
News_con=News_con&"[共"&rs.RecordCount&"件产品 "&rs.PageSize&"件/页]"
News_con=News_con&"</div>"
rs.close
Set rs = Nothing
mb_code=replace(mb_code,"$leftmenu$",leftmenu)
mb_code=replace(mb_code,"$content$",News_con)
filename="../Htmlfile/ProductList_"&page&".html"'要生成的页
Set files = fso.CreateTextFile(Server.MapPath(filename),true) '生成HTML页
files.WriteLine mb_code '写入内容
files.close
set files=nothing
'set fso=nothing
next