How to apply Pagination in ASP

Also in ASP it is possible to apply the pagination of records both to avoid high loading times and also because one page with too many records it would be too long to consult.

By pagination we mean a division of the records produced by the same query but distributed over several pages, where in reality the page is always the same, only the results change according to the choice of the page number browsed.


How to apply Pagination in ASP

How to apply Pagination in ASP


Let's see our Asp page in summary:

<% Dim DBConn, strconn
set dbconn=server.createobject(“ADODB.connection”)

strconn=”Provider = Microsoft.Jet.OLEDB.4.0; Data Source =” & Server.MapPath (“data/utenti.mdb”)

dbconn.open strconn

No objRS

Set objRS = Server.CreateObject(“ADODB.Recordset”)

RecordsPerPagina = 5 'NUMBER OF RECORDS TO DISPLAY FOR EACH PAGE

page = Request(“page”)

if page=”” then page=1

strSQL = “SELECT * FROM sorgenti order by nomesorgente;”

objRS.open strSQL, DBConn, 1

objRS.PageSize = RecordsPerPagina

objRS.AbsolutePage = page

If objRS.Eof=True or objRS.Bof=True then

Response.Write " No results found "

else

Response.Write (“NomeLinguaggioAutore”)

For i=1 to RecordsPerPagina

if Not objRS.EOF then

Response.Write(“” & objRS(“nomesorgente”) & “”)

Response.Write (" "& ObjRS (" language ") &" ")


Response.Write(“” & objRS(“nickname”) & “”)

objRS.MoveNext

end if

Next

Response.Write (“”)

End if

Response.Write “Pagine: “


For pag = 1 to objRS.PageCount

Response.Write “”

Response.Write pag

Response.Write “ “

Next

Response.Write “”

objRS.Close

Set objRS=Nothing

DBConn.Close

Set DBConn=Nothing

%>

Let me know if it works for you.

add a comment of How to apply Pagination in ASP
Comment sent successfully! We will review it in the next few hours.