主题:  ASP分页程序有问题,请帮助!

flashzi

职务:普通成员
等级:1
金币:0.0
发贴:71
#12003/3/30 13:55:32
我这个留言册很简单,只用了一个分页技术。可是怎么着也分页不了

请各位帮助指点,网站测试地址[url=[连接]
在原代码如下:

<%
    MaxPerPage=10
    dim totalPut
    dim CurrentPage
    dim TotalPages

    if (request.QueryString("page"))<>""then
    currentPage=cint(request.QueryString("page"))
    else
    currentPage=1
    end if

    set rs=server.createobject("adodb.recordset")
    sqlstr="select id from message where name='"&request.form("txt_name")&"' and message='"&request.form("txt_message")&"' order by id desc"
    rs.open sqlstr,conn,1,1
    if rs.eof and request.form("submit")="确定" then
        rs.close
        sqlstr="insert into message(name,company,phone,fax,email,message) values('" & request.form("txt_name") & "','" & request.form("txt_company") & "','" & request.form("txt_phone") & "','" & request.form("txt_fax") & "','" & request.form("txt_email")& "','" & request.form("txt_message") & "')"
        rs.open sqlstr,conn,1,3
    else
        rs.close
    end if

    sqlstr="select id,name,company,phone,fax,email,message,time from message order by id desc"
    rs.open sqlstr,conn,1,1
%>




通力天光-无锡数码影像站

















































































































<%
    if not rs.eof then
        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
            showContent
            showpage totalput,MaxPerPage
        else
            if (currentPage-1)*MaxPerPage                newsrs.move (currentPage-1)*MaxPerPage
                dim bookmark
                bookmark=newsrs.bookmark
                showpage totalput,MaxPerPage
                showContent
                showpage totalput,MaxPerPage
            else
                currentPage=1
                showpage totalput,MaxPerPage
                showContent
                showpage totalput,MaxPerPage
            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 %>







<% i=i+1
        if i>=MaxPerPage then exit do
        rs.movenext
        loop
     %>

<% if rs("email")<>"" then
                response.write ""&rs("name")&""
             else
                response.write rs("name")
             end if
         %>


(<%=rs("time")%>)

<% if rs("company")<>"" then response.write "  公司:"&rs("company")
             if rs("phone")<>"" then response.write "   电话:"&rs("phone")
             if rs("fax")<>"" then response.write "   传真:"&rs("fax")
         %>

<% =rs("message")%>


<%
end sub


function showpage(totalnumber,maxperpagee)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if

Response.Write ""
response.write ""

response.write "
"
Response.Write "共有留言:"&totalnumber&""&CurrentPage&"/"&n&"页
"
if CurrentPage<2 then
response.write "首页 上一页 "
else
response.write "首页 "
response.write "上一页 "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "     response.write " class=""text"">下一页 尾页"
end if
Response.Write "
"
end function
%>








Copyright© www.suma8.com 2003
All rights reserved. Designed by noshadow

QQ:2654720 Email:flashzi@hotmail.com














onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.suma8.com');">





Anjer

职务:普通成员
等级:1
金币:0.0
发贴:48
#22003/3/31 11:08:51
在这里见到你,你的代码里面的newsrs是做什么用的呢?
没有看到你在前面定义呀



flashzi

职务:普通成员
等级:1
金币:0.0
发贴:71
#32003/3/31 13:45:42
哈哈,这个问题 我已经kill了,是newsrs有问题,不过下面也出现了一个问题。现在ok了!!