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


 


Financial Graph
Utilizing some simple html and the output from an access db effective graphs can be produced without the need for third party components.  The example data base contains the weekly highs (high), the week ending date (weekof) and stock split (split) info for Yahoo. The height of an image file (blue.jpg) is adjusted to the week ending high (high) and the alt for that image is set to the week ending date (weekof) and the value (high).
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data

<%
accessdb="stocks" 
cn="DRIVER={Microsoft Access Driver (*.mdb)};"
cn=cn & "DBQ=" & server.mappath(accessdb)
Set rs = Server.CreateObject("ADODB.Recordset")
sql = "select * from yahoo order by weekof asc " 
rs.Open sql, cn
%>

<div align="center">
<table cellspacing="0" cellpadding="0">
<tr>
<%
On Error Resume Next
rs.MoveFirst
' sets the low and high for the range equal to the 1st weeks high
low = rs("high")
high=rs("high")
do while Not rs.eof
%>

<td width="5" align="left" valign="bottom">
<img src="images/blue.jpg" width="5" height="<%= rs("high") %>
alt="Week of <%= rs("weekof") %>, High was $<%= formatnumber(rs("high"),2) %>"></td>
<%
' if the current week is lower then the 1st or any lower week then place it in low
if low > rs("high") then 
low = rs("high") 
end if
' if the current week is higher then the 1st or any higher week then place it in high
if high < rs("high") then 
high = rs("high") 
end if
' what is the latest week
last_week=rs("weekof")
' counts the number of cells being used to generate the dynamic graph
count_cells=count_cells+1
' if there was a split add it to splits
if rs("split") <> "" then
splits= splits & "<br>" & rs("split") & "-" & rs("weekof")
end if
rs.MoveNext
loop
%>


<table cellspacing="0" cellpadding="0"><tr>
<td align="center" valign="top" width="<%= count_cells*5 %>">
<% rs.Movefirst %>
<br>
Yahoo Weekly Highs from <%= rs("weekof")%> to <%= last_week %>
<br>Low for this range : $<%= formatnumber(low,2) %>
<br>High for this range : $<%= formatnumber(high,2) %>
<br> <%= splits %>
</td></tr></table>

</div>

 

 

 



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
Maps: Map Script Writers | Bing Maps | Google Maps
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 - 2014 CodeAve.com
All Rights Reserved

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