CodeAve.com CodeAve.com - ASP - Database Table Display
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


Alphabetic Database Display
Alphabetic navigation of a database provides a unique way to display just about data.  A simple for next loop generates all of the alphabetic hyperlinks into the database and an sql statement targeted to the first letter in the targeted field allows for alphabetic displaying of data.  Utilizing our database with all fifty states in it we will hyperlink the letters A-Z and based on that input search the data for all states that begin with the letter the user clicked on.
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data

<html>
<title>Alphabetic Database Display</title>
<body bgcolor="#FFFFFF">
<%
for counter = 65 to 90
' for next routine to create hyperlinks alphabetically targeted
' to the current page 
%>

<a href="<%= request.servervariables("script_name")%>?u_letter=&#<%= counter %>;">
&#<%= counter %>;</a> 
<% next %>
<p>

<%
u_letter=trim(request.querystring("u_letter"))
'if the user clicked a link then search the db
if u_letter<>"" then
accessdb="state_info" 
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)
Set rs = Server.CreateObject("ADODB.Recordset")

sql = "select * from states where left(statename,1)='"& u_letter &"' order by statename asc"

rs.Open sql, cn
'if the search ends in no results display a
'no results found mesage
if rs.eof then
%>

No states begin with the letter <%= u_letter %>
<% else 
do while not rs.eof
'display all observations found
%>

<br>
<%= rs("statename") %>
<%
rs.movenext
loop
end if ' end check for obs
end if ' end check for user input
%>

 

 

 



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

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

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