CodeAve.com CodeAve.com - ASP - Read/Write
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


 


Access To HTML
Active Server Pages allow for the easy ability to create dynamic views of your data on a web server, but did you know that you can dynamically create "static" html documents. This can be particularly useful if you wish to distribute your information on CD or diskette without requiring the user to have personal web server or access installed locally. The following example will utilize our state info db 

After reading the contents of the db instead of writing output to the browser it is written to the server. Each observation (state) will have its own dynamically created page with its corresponding info displayed as well. A table of contents page is also created (in the browser) for easy navigation around all the state pages. The current time (server time) is also added to show that all the .htm pages are created on the fly.
View the Output
Text View
Print View
Mail this Link
Download the Code
View the Data


<%
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 " 
rs.Open sql, cn
rs.MoveFirst
do while not rs.eof

' Creates a text file on the server with the state abbreviation 
' as the name for the ouput document 
file_being_created= rs("state") & ".htm"
set fso = createobject("scripting.filesystemobject")
Set act = fso.CreateTextFile(server.mappath(file_being_created), true)

' Writes the db output to a .htm file in the same directory 
act.WriteLine("<title>CodeAve.com(" & rs("statename") & " State Info)</title>")
act.WriteLine("<body bgcolor='#FFFFFF'> " )
act.WriteLine("State: " & rs("statename") & "<br>" )
act.WriteLine("Abbreviaton: " & rs("state") & "<br>" )
act.WriteLine("Capital: " & rs("capital") & "<br>")
act.WriteLine("Entered the Union in "& rs("year") & "<br>")
act.WriteLine("Number in order of entrance into the Union "& rs("order") & "<br>")
act.WriteLine("Page created on: " & now ())
act.close

' Writes the links to the newly created pages in the browser
response.write "<a href='" & rs("state") & ".htm'>" & rs("statename") & "</a>&nbsp;" & now() & "<br>"
rs.movenext
loop
%>

 

 

 



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