HI ..
any one of you people can help me in asp paging..
Its actually a knowledge base link in which i am displaying the records
based on the filtering we want.it dispalys the records but where to include the paging code...
i got some code from net..
but its not displaying properly....
:confused:

inside the loop after the stuff to be shown ie

<% do while recordset <> bof and recordset <> eof

your recordset fields

recordset.movenext (cant remember exact code)#

loop %>

No..
See for recordset there are some properties like how many records to be displayed in a single page if we click next it has to show the second page.(that means second set of records)....
:idea:

This' from an old guest book i wrote.
Not the most stream lined code ever, but should give you an idea....

<%
Dim adoCon 			
Dim rsGuestbook
Dim strSQL
Dim adoCon1
Dim strEmail
Dim strSQL1
Dim rsEmail
Dim testv
Dim test1
Dim intRecordspp
Dim intTotalRecords
Dim intTotalPages
Dim intPageNum
Dim strBlah1
Dim strBlah2

If Request.QueryString("rpp") = "" Then
	intRecordspp = 10
Else
	intRecordspp = CInt(Request.QueryString("rpp"))
End If

If Request.QueryString("PageNumber") = "" Then
	intPageNum = 1
Else
	intPageNum = CInt(Request.QueryString("PageNumber"))
End If	

Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "Driver={mySQL};......
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT Name, Comments, Date_stamp FROM users ORDER BY Date_stamp DESC;"
rsGuestbook.CursorType = 3
rsGuestbook.Open strSQL, adoCon
rsGuestbook.PageSize = intRecordspp

If NOT rsGuestbook.EOF Then rsGuestbook.AbsolutePage = intPageNum
intTotalRecords = rsGuestbook.RecordCount
intTotalPages = rsGuestbook.PageCount
%>
<A NAME="top">
<TABLE CELLPADDING=10 CELLSPACING=0 BORDER=0 WIDTH="100%">
	<TR>
		<TD>Guestbook currently holds <B><%=intTotalRecords%></B> comments.<BR><A HREF="addcom.asp">Add comment</A>
<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%">
<TR><TD></TD><TD align="right">Page <%= intPageNum%> of <%= intTotalPages%>
<BR>
<%
If intPageNum = 1 Then
Else %>
<A HREF="gb.asp?PageNumber=<%= intPageNum -1%>&rpp=<%= Request.QueryString("rpp")%>">Back</A>
<%
End If
%>

<% If intPageNum < intTotalPages Then %>
<A HREF="gb.asp?PageNumber=<%= intPageNum +1%>&rpp=<%= Request.QueryString("rpp")%>">Next</A>
<%
Else
End If
%>
</TD></TR></TABLE><p>
<% 
for strBlah2 = 1 to intRecordspp
if Not rsGuestbook.EOF Then

%>

<TABLE WIDTH="100%" CELLPADDING=1 CELLSPACING=0 BORDER=0>
  <TR>
    <TD CLASS="field">
      <TABLE WIDTH="100%" CELLPADDING=2 CELLSPACING=0 BORDER=0>
        <TR>
          <TD CLASS="border">Comment posted by <B><%= rsGuestbook("Name") %></B></TD>

        </TR>
        <TR>
          <TD><BR><%= rsGuestbook("Comments") %><P></TD>
        </TR>
	<TR>
	  <TD align=right><%= rsGuestbook("Date_stamp") %></TD>
	</TR>
      </TABLE>
    </TD>
  </TR>
</TABLE>

<BR>
<%
	rsGuestbook.MoveNext
End If
Next

'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
Set adoCon1 = Nothing 
Set rsEmail = Nothing
%>
<P align=right><A HREF="#top">Top</A><BR>&nbsp<BR>
Page <%= intPageNum%> of <%= intTotalPages%>
<BR>
<%
If intPageNum = 1 Then
Else %>
<A HREF="gb.asp?PageNumber=<%= intPageNum -1%>&rpp=<%= Request.QueryString("rpp")%>">Back</A>
<%
End If
%>

<% If intPageNum < intTotalPages Then %>
<A HREF="gb.asp?PageNumber=<%= intPageNum +1%>&rpp=<%= Request.QueryString("rpp")%>">Next</A>
<%
Else
End If
%>

you must declarate

There is a short but useful article here.. You should look at this:

<URL SNIPPED>Listing Records and ADO Recordset Paging in ASP

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.