注册 登录
编程论坛 ASP技术论坛

ASP分页问题.求高手帮忙

linjirongll 发布于 2008-04-11 18:00, 513 次点击
那位高手帮我看看,我遇到的问题是ID接收显示面的分页问题,能够正常显示,但一点分页就出现对像已关闭无法操作的错误,如果不是在ID接受页这个分页又可以正常使用,希望高手能帮一下.我只要实现的功能是:根本接收到的ID来判断搜索那个表单的数据库,然后列出那表单的数据,因为数据过多要分页.
<%name=request.QueryString("id")

Set conn=server.CreateObject("adodb.connection")
    crt="provider=Microsoft.JET.OLEDB.4.0;Data Source="&Server.MapPath("shuju.mdb")
    conn.open crt
    set rs=server.createobject("adodb.recordset")
    if name="new"then /这个是我用来判断执行下面搜索那个表的语句
        rs.open"select * from new ",conn,1,1
        <%end if%>
        if name="new2"then
        rs.open"select * from new2 ",conn,1,1
    <%end if%>
    dim   zongye,page,coun  
             rs.pagesize=15                           
        zongye=rs.pagecount
        page=trim(request.querystring("page"))
        if page="" then page=1
        if not isnumeric(page) then page=1
        page=cint(page)
        if page<1 then page=1
        if zongye<1 then zongye=1
        if page>zongye then page=zongye
        rs.absolutepage=page
        
        
        
         if rs.bof and rs.eof then
         response.write("没有任何新闻")
        else
           rs.absolutepage=page
            js=rs.pagesize
           do while not  rs.eof and  js>0%>

            <%=rs("title")%>
    <%js=js-1
            rs.movenext
        loop
            end if %>
<table>
<tr>
<td width="45"><a href="cc.asp?id=<%=name%>?page=<%=zongye-(zongye-1)%>">第一页</a></td>
<td width="45"><a href="cc.asp?id=<%=name%>?page=<%= page-1%>">上一页</a></td>
<td width="45"><a href="cc.asp?id=<%=name%>?page=<%= page+1%>">下一页</a></td>
<td width="49"><a href="cc.asp?id=<%=name%>?page=<%=zongye%>">最后一页</a></td>
</tr></table>
4 回复
#2
tianyu1232008-04-11 18:19
具体提示那行错误!
#3
yms1232008-04-11 18:20
建议分页另外启用一个rs来做,用一个rs很有可能会出现错误。
#4
linjirongll2008-04-11 22:03
那个高手帮帮忙啊,真的急啊,谢谢
#5
szlinz2008-04-12 10:26
到网上搜一个分页类就好了,没必要自己写。
1