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


Paged Record Output from User Search Input
When you begin dealing with larger databases and offer search capabilities 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 based on user search requirements, but limit each page to display no more than four states at a time. The example db is rather small, so searching by letter rather than words is best for a fuller demonstration.
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data

if u_search <> "" then 
' 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 where statename like '%%"& u_search &"%%'" 

' *********************************** 
' Implements the value from
' *************************************
rs.cachesize=5 sql,cn
if not rs.eof then 
g_search="obs found"

' 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")%>'>
<input type = "hidden" name="u_search" value="<%= u_search %>">
<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 = "hidden" name="u_search" value="<%= u_search %>">
<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="u_search" value="<%= u_search %>">
<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>" %>
end if
end if
'Check to see if the search resulted in observations found
'if not then display a message that states no results found
if g_search <> "obs found" then
response.write "Nothing reults found for your search on <i>"& u_search &"</i><br>" 
end if %>

<form action="<%= request.servervariables("script_name") %>" method="post">
<input type="text" name="u_search" value="<%= u_search %>">
<input type="submit" value="Search">




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 - 2019
    All Rights Reserved

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