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


Name Search & Hyperlinks to Detail
Searching a data base to display hyperlinked summaries that can be clicked on to display detail data provides an excellent way to navigate through your data. The following example will search our test input db of names from our example on Database Input and Display which contains last name (lname), first name (fname) and unique id (unique_id a counter of all names as they are added to the db).  The user will can search the first or last name and click on any of the results to reveal the detail data (the unique id, which is all the data we have in this db) all in the same active server page.  Note:  The db on the server contains data primarily created by users of, as a consequence some of the data contained in the db may be questionable.
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data

'Checks to see if the user has submitted a search or 
'clicked a hyperlink
if u_search <> "" or u_id <> "" then
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)
Set rs = Server.CreateObject("ADODB.Recordset")
'Determines if the user submitted a search or clicked a link
if u_id <> "" then
sql= "select * from testtable where unique_id=" & u_id
sql = "select * from testtable where "& u_exp &" like '%%" &u_search &"%%' " 
end if
rs.Open sql, cn

<%'if there are no observations found display no record found 
if rs.eof then %>

No selections could be found 
<% ' if observations are found display them 
else %>

<table BORDER="1">
' if the user clicked a link from a search
' display the detailed data titles 
if u_id <> "" then %>

<td>Unique ID</td>
<% end if %>
do while not rs.eof

<a href="<%=request.servervariables("script_name") %>?u_id=<%= rs("unique_id") %>">
<%= rs("lname") %>, <%= rs("fname") %></a>
' if the user clicked a link from a search
' display the detailed data 
if u_id <> "" then %>

<%= rs("unique_id") %>
<% end if %>
' end check for no obs
end if
' end check for no input
end if %>

<body bgcolor="#FFFFFF">
<form action="<%=request.servervariables("script_name") %>" method="post">
<input type="text" name="u_search" value="<%= u_search %>">
<select size="1" name="u_exp">
<option <% ' if user selected to search by last name list is first in the dropdown menu
if u_exp = "lname" then %>
selected <%end if%>value="lname">Last Name</option>
<option <% ' if user selected to search by last name list is first in the dropdown menu
if u_exp = "fname" then %>
selected <%end if%>value="fname">First Name</option>
<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 - 2018
    All Rights Reserved

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