here is one example on how to use the pagenav function:
<!-- #include virtual="include/_pagenav.asp" --> '--- define variables Dim intPageSize, intRecordCount, intRecords, intLastPage, intCurrentPage intPageSize = 5 '--- define the page size you want -database connection string -recordset connection rs.open SQL, Connection, adOpenStatic, adLockReadOnly, adCmdText intRecordCount = rs.RecordCount '--- fetch the total number of records in the database
If Not rs.EOF Then If len(Request.Querystring("page")) > 0 then intCurrentPage = CLng(Request.Querystring("page")) Else intCurrentPage = 1 End if For intRecords = 1 to intRecordCount If intRecords = ((intCurrentPage * intPageSize) - intPageSize) Then database records showing End if rs.Movenext Next Else response.write "No record found" End if rs.Close Set rs = Nothing
intLastPage = int(intRecordCount/intPageSize) + 1 '--- calculates the last page number if intLastPage = 0 then intLastPage = 1 '--- set always last page > 0 to avoid errors Call PageNav(intCurrentPage, intLastPage) '--- cal the pagenav function and show navigation commands
Database management grid with record edit, delete, add, search, filter and export to excel, database and table dropdown selection, pages navigation, field sort and search in page.