- ASP - Database Table Display
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·What's New?
Mail List


Paged Record Output
When you begin dealing with larger databases it becomes essential to offer the ability to view a few of the database observations at a time rather than dumping the whole db out to the browser. The following script will display the 50 United States, but limit each page to display no more than four states at a time. A total of thirteen pages can by dynamically created from dropdown menu input or buttons leading to the previous or next page. This script is easily adaptable into a db search tool.
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data

<% ' Grabs the contstant for cursorlocation %>
<!--#include file="" -->
' Check the value of p (page) and make sure it is not null
' If a null value is found then 1 is put in its place
if p = "" then 
end if

cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)
set rs = server.createobject("ADODB.Recordset")
sql = "select statename from states " 

' *********************************** 
' Implements the value from
' *************************************
rs.cachesize=5 sql,cn

' Sets the number of observations per page to a max of four




<table border="0">
<tr><td valign=top><b>State</b></td></tr>
<%do while not rs.eof and numofobs<rs.pagesize%>
<tr><td valign=top><%=rs("statename")%></td></tr>
' Counts the number of observations in the current page


<form method='post' action='<%= request.servervariables("script_name")%>'>
<select name='p' size='1'>

' Starts loop from one to the maximum number of pages 
for counter=1 to cint(rs.pagecount)

' This will select the current page in the dropdown menu
if cint(p) = cint(counter) then 
response.write " selected "
end if
value="<%= counter %>">Page <%= counter %> of <%= cint(rs.pagecount) %></option>
<% next %>
<input type="submit" value="Go"</p>
if p <> 1 then

<form method='post' action='<%= request.servervariables("script_name")%>'>
<input type = "hidden" name="p" value="<%= p-1 %>">
<input type = "submit" value="&lt;">&nbsp;Previous Page
<% end if %>
if cint(p) < cint(rs.pagecount) then

<form method='post' action='<%= request.servervariables("script_name")%>'>
<input type = "hidden" name="p" value="<%= p+1 %>">
Next Page&nbsp;<input type = "submit" value="&gt;">
<% end if %>
<%= numofobs &" states on displayed this page<br>" %>




ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement is hosted by
    Donate Food Online with a Mouse Click at
    Donate Land Online with a Mouse Click at
    © 1999 - 2018
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3