這是在我執行的結果 有問題加qq:517123363 給你個參考 dim conn set conn=server.createobject("adodb.connection") conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("sooe.mdb") conn.open %> sql="select * from sooe order by c_id desc" set rc=server.CreateObject("adodb.recordset") rc.open sql,conn,1,1 if not isempty(request("page")) then currentPage=cint(request("page")) else currentPage=1 end if MaxPerPage=10 if rc.eof and rc.bof then response.write " 還 沒 有 任 何 產 品 !" else totalPut=rc.recordcount if currentpage 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,"adminedit.asp" showContent showpage totalput,MaxPerPage,"adminedit.asp" else if (currentPage-1)*MaxPerPage rc.move (currentPage-1)*MaxPerPagedim bookmark bookmark=rc.bookmark showpage totalput,MaxPerPage,"adminedit.asp" showContent showpage totalput,MaxPerPage,"adminedit.asp" else currentPage=1 showpage totalput,MaxPerPage,"adminedit.asp" showContent showpage totalput,MaxPerPage,"adminedit.asp" end if end if rc.close end if sub showContent dim i i=0 %> "> 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 " " if CurrentPage response.write "首頁 上一頁 " else response.write "首頁 " response.write "上一頁 " end if if n-currentpage response.write "下一頁 尾頁" else response.write "" response.write "下一頁 尾頁" end if response.write " 頁次:"&CurrentPage&"/"&n&"頁 " response.write " 共"&totalnumber&"個商品 "&maxperpage&"個商品/頁 " end function rc.close set rc=nothing conn.close set conn=nothing %>
這段程式碼,可以執行,請檢查資料庫,及欄位名稱 請看圖片
這是在我執行的結果 有問題加qq:517123363 給你個參考 dim conn set conn=server.createobject("adodb.connection") conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("sooe.mdb") conn.open %> sql="select * from sooe order by c_id desc" set rc=server.CreateObject("adodb.recordset") rc.open sql,conn,1,1 if not isempty(request("page")) then currentPage=cint(request("page")) else currentPage=1 end if MaxPerPage=10 if rc.eof and rc.bof then response.write " 還 沒 有 任 何 產 品 !" else totalPut=rc.recordcount if currentpage 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,"adminedit.asp" showContent showpage totalput,MaxPerPage,"adminedit.asp" else if (currentPage-1)*MaxPerPage rc.move (currentPage-1)*MaxPerPagedim bookmark bookmark=rc.bookmark showpage totalput,MaxPerPage,"adminedit.asp" showContent showpage totalput,MaxPerPage,"adminedit.asp" else currentPage=1 showpage totalput,MaxPerPage,"adminedit.asp" showContent showpage totalput,MaxPerPage,"adminedit.asp" end if end if rc.close end if sub showContent dim i i=0 %> "> 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 " " if CurrentPage response.write "首頁 上一頁 " else response.write "首頁 " response.write "上一頁 " end if if n-currentpage response.write "下一頁 尾頁" else response.write "" response.write "下一頁 尾頁" end if response.write " 頁次:"&CurrentPage&"/"&n&"頁 " response.write " 共"&totalnumber&"個商品 "&maxperpage&"個商品/頁 " end function rc.close set rc=nothing conn.close set conn=nothing %>