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


 


Display Table (Order By Hyperlinked Table Variable)
Ordering data the way a user wants/needs to see it can be a harrowing task, but it does not need to be.  Utilizing the career statistics of Hall of Famer Hammerin' Hank Greenberg of the Detroit Tigers the following script demonstrates how to display a database ordered by hyper-linked table variables.  The SQL statement that is dynamically generated by user input is also displayed in the output.
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data


<%
u_order=request.querystring("u_order")
%>


<% select case u_order
case "year","team","avg","ab","r","h","double","triple","hr","rbi","bb","so","sb" %>

<% case else
response.redirect "table_order.asp?u_order=year"
end select
%>

<%
accessdb="greenberg" 
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)
Set rs = Server.CreateObject("ADODB.Recordset")

sql = "select * from hammerin_hank order by "& u_order &" desc;" 

response.write sql

rs.Open sql, cn

%>


<html>
<body link="#0000FF" vlink="#0000FF" alink="#0000FF">
<div align="center">
<center>
<TABLE BORDER="0" BGCOLOR="#ffffff" CELLSPACING="0" width="640">

<THEAD>
<TR>
<TH valign="top" align="left" width="49"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=year">Year</a></FONT></TH>
<TH valign="top" align="left" width="49"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=team">Team</FONT></TH>
<TH valign="top" align="left" width="49"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=avg">AVG</FONT></TH>
<TH valign="top" align="left" width="49"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=ab">AB</FONT></TH>
<TH valign="top" align="left" width="49"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=r">R</FONT></TH>
<TH valign="top" align="left" width="49"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=h">H</FONT></TH>
<TH valign="top" align="left" width="49"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=double">2B</FONT></TH>
<TH valign="top" align="left" width="49"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=triple">3B</FONT></TH>
<TH valign="top" align="left" width="49"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=hr">HR</FONT></TH>
<TH valign="top" align="left" width="49"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=rbi">RBI</FONT></TH>
<TH valign="top" align="left" width="50"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=bb">BB</FONT></TH>
<TH valign="top" align="left" width="50"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=so">SO</FONT></TH>
<TH valign="top" align="left" width="50"><FONT SIZE="1" FACE="Arial"><a href="table_order.asp?u_order=sb">SB</FONT></TH>

</TR>
</THEAD>
<TBODY>

<%
On Error Resume Next
rs.MoveFirst
do while Not rs.eof
%>


<TR VALIGN=TOP>
<TD ALIGN="left" valign="top" width="49"><FONT SIZE="1" FACE="Arial"><%=rs("Year") %></FONT></TD>
<TD ALIGN="left" valign="top" width="49"><FONT SIZE="1" FACE="Arial"><%=rs("Team") %></FONT></TD>
<TD ALIGN="left" valign="top" width="49"><FONT SIZE="1" FACE="Arial"><%=rs("AVG") %></FONT></TD>
<TD ALIGN="left" valign="top" width="49"><FONT SIZE="1" FACE="Arial"><%=rs("AB") %></FONT></TD>
<TD ALIGN="left" valign="top" width="49"><FONT SIZE="1" FACE="Arial"><%=rs("R") %></FONT></TD>
<TD ALIGN="left" valign="top" width="49"><FONT SIZE="1" FACE="Arial"><%=rs("H") %></FONT></TD>
<TD ALIGN="left" valign="top" width="49"><FONT SIZE="1" FACE="Arial"><%=rs("Double") %></FONT></TD>
<TD ALIGN="left" valign="top" width="49"><FONT SIZE="1" FACE="Arial"><%= rs("Triple") %> </FONT></TD>
<TD ALIGN="left" valign="top" width="49"><FONT SIZE="1" FACE="Arial"><%=rs("HR") %></FONT></TD>
<TD ALIGN="left" valign="top" width="49"><FONT SIZE="1" FACE="Arial"><%=rs("RBI")%></FONT></TD>
<TD ALIGN="left" valign="top" width="50"><FONT SIZE="1" FACE="Arial"><%=rs("BB") %></FONT></TD>
<TD ALIGN="left" valign="top" width="50"><FONT SIZE="1" FACE="Arial"><%=rs("SO") %></FONT></TD>
<TD ALIGN="left" valign="top" width="50"><FONT SIZE="1" FACE="Arial"><%=rs("SB") %></FONT></TD>
</TR>
<%
rs.MoveNext
loop%>

</TBODY>
<TFOOT></TFOOT>
</TABLE>
</center>
</div>
</BODY>
</HTML>

 

 

 



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