asafaq article id=2120 - paging

G

Girish

I am trying to use GetRowsMove method since we are not using stored
procedures, I got until 77 rows found. Showing page 1 of 2. - nothing shows
up in the list box and GetRowsMove.asp I couldn't get that up and running
instead of your recordset I am pulling from my own database that is the only
difference...

Thanks
 
A

Aaron Bertrand - MVP

You're going to need to show your code. We can't fix what we can't see.
 
G

Girish

here is the include page <!-- #include
virtual="/carmartnew/include/topRS.asp.asp" -->code:
<% 'Option Explicit
'response.buffer = true%>
<%
Dim strQrySelect3, RowCnt, RecSet3, PerPage, PageNum, PageCnt, rsOutput3
RowCnt = 0

RowCnt = rscount ' rscount is my recordset from DB

if RowCnt = 0 then
Response.Write "No rows found."
Response.End
end if

PerPage = Trim(Request.QueryString("PerPage"))
PageNum = Trim(Request.QueryString("PageNum"))

If PerPage = "" or (len(PerPage)>0 and not isnumeric(PerPage)) Then _
PerPage = 50

If PageNum = "" or (len(PageNum)>0 and not isnumeric(PageNum)) Then _
PageNum = 1

PerPage = PerPage
PageNum = PageNum

'response.write "RowCnt :" &RowCnt&"<br>"
'response.write "PerPage :" &PerPage&"<br>"
PageCnt = RowCnt \ PerPage

if RowCnt mod PerPage <> 0 then PageCnt = PageCnt + 1
if PageNum < 1 Then PageNum = 1
if PageNum > PageCnt Then PageNum = PageCnt

Dim url, urlParts, pageName

url = Request.ServerVariables("SCRIPT_NAME")
urlParts = split(url, "/")
pageName = urlParts(ubound(urlParts))
%>
<script language="JavaScript" type="text/javascript">
function go(p)
{
if (p!='current')
window.location.href = "<%=pageName%>?"
+"PerPage=<%=PerPage%>&"
+"PageNum="+p;
}
</script>
<%
response.write RowCnt & " rows found. Showing " & _
" page " & PageNum & " of " & PageCnt & "."

response.write " <select onchange='go(this.value);'>"

for i = 1 to PageCnt
link = i: s = ""
if i = PageNum then link = "current": s=" SELECTED"
response.write "<option value=" & link & s & ">" **
I don't get any value here in select list.
response.write "Page " & i
next
Response.Write "</select><p>"

%>

Here is the code of CODE page as per your article where I am including above
page

** This code suppose to do what??? need more explanation...
Dim gr, rstop
rstop = PerPage * PageNum
rstart = rstop - (PerPage - 1)
rs.move(rstart-1)** main change
rsOutput2.move(rstart-1)

if rstop > RowCnt - 1 then PerPage = (RowCnt - 1) - rstart
gr = rs.GetRows(PerPage)
gr = rsOutput2.GetRows(PerPage)

response.write "gr" & gr

for i = 0 to perpage-1

artist = gr(0, i)
title = gr(1, i)

response.write "artist" & artist
next

Thanks much! Would you also do consulting?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top