SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict djh's Avatar
    Join Date
    Apr 2000
    Location
    Long Beach, CA
    Posts
    333
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    .absolutePage (paging thru recordsets)

    Ok, I'm stuck guys... need some help.

    for some reason, I can't seem to set the .absolutePage of my recordset! it always stays at -1.

    Check out what I mean - I'm outputting the values so you can see...

    goboatingamerica.com/boat_search.asp?area=power

    thanks guys!

  2. #2
    ALT.NET - because we need it silver trophybronze trophy dhtmlgod's Avatar
    Join Date
    Jul 2001
    Location
    Scotland
    Posts
    4,836
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dont know if this is exactly what ur looking for, but i think it is


    Code:
    function getNext10(num)
    		pageLen = len(num)
    		if pageLen = 1 then
    			next10 = 10
    		elseif pageLen = 2 then
    			pageRem = 10
    			pageTen = right(num, 1)
    			next10 = num + pageRem - pageTen
    		elseif pageLen > 2 then
    			pageRem = 10
    			pageTen = right(num, 1)
    			next10 = num + pageRem - pageTen
    		end if
    		getNext10 = next10
    	end function
    
    	function getPrev10(num)
    		pageLen = len(num)
    		if pageLen = 1 then
    			prev10 = 1
    		elseif pageLen = 2 then
    			firstDig = left(num, 1)
    			secondDig = right(num, 1)
    			prev10 = num - secondDig - 10
    		elseif pageLen > 2 then
    			firstDig = right(num, 2)
    			secondDig = right(num, 1)
    			prev10 = num - secondDig - 10
    		end if
    		if prev10 = 0 then
    			prev10 = 1
    		end if
    		getPrev10 = prev10
    	end function
    	RSPrevPage = CurrPage -1
    	RSNextPage = CurrPage + 1
    	next10 = getNext10(currPage)
    	prev10 = getPrev10(currPage)
    	if Next10 > RS.PageCount then
    		next10 = RS.PageCount
    	end if
    	if prev10 = 1 AND next10 - 1 < 10 then
    		start = 1
    	else
    		start = Next10 - 10
    		if right(start, 1) > 0 then
    			start = replace(start, right(start, 1), "0")
    			start = start + 10
    		end if
    	end if
    	if RS.PageCount > 1 then
    		if next10 > 10 then
    			response.write("<p class=""para1""><a href=""" & _
    			request.servervariables("SCRIPT_NAME") & "?PageNo=" & Prev10 & """><<</a>   ")
    		end if
    		if not RSPrevPage = 0 then
    			response.write("<a href=""" & request.servervariables("SCRIPT_NAME") & "?PageNo=" & RSPrevPage & """><</a>   ")
    		end if
    		for P = start to Next10
    			if not P = CurrPage then
    				response.write("<a href=""" & request.servervariables("SCRIPT_NAME") & "?PageNo=" & P &  """>" & P & "</a> ")
    			else
    				response.write(" <b>" & P & " </b>")
    			end if
    		Next
    		if not RSNextPage > RS.PageCount then
    			response.write("<a href=""" & request.servervariables("SCRIPT_NAME") & "?PageNo=" & RSNextPage & """>></a>  ")
    		end if
    		if not Next10 = RS.PageCount then
    			response.write("   <a href=""" & request.servervariables("SCRIPT_NAME") & "?PageNo=" & Next10 & """>>></a>")
    		end if
    	end if
    thats the paging script, now to get the info...
    Code:
    if isempty(request.querystring("PageNo")) then
    			CurrPage = 1
    		else
    			CurrPage = cint(request.querystring("PageNo"))
    		end if
    		
    		Set RS = Server.CreateObject("ADODB.Recordset")
    		RS.CursorLocation = 3
    			RS.Open "SQL", Connection string
    		if RS.EOF then
    			response.write("<p>Sorry, nothing could be found in our database. Please try again with some different words")
    		end if
    	else
    		RS.PageSize = 5
    		RS.AbsolutePage = CurrPage
    hope its what u where looking for


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •