snippet library logo
in category
ASP / Site Navigation / Link Page
Snippet details
ID: 528
Viewed: 1200
Added: 2004-09-02
Version: unknown

User Rated at: 3 Stars
Rate This:
Snippets in this catagory         
Show Printable Version
This is a simple ASP page to read an Access Database and build a page to display your stored links.

You will need an Access Database with the following Tables:
 Cat01 (Catagories for your links to fall under)
  CatKey - AutoNumber
  CatName - text
  CatDescription - text
 Link01
  LinkKey - AutoNumber
  LinkURL - text (Do not include http://)
  LinkDescription - text
  LinkCat - text (In this field you will enter the CatKey field to the cooresponding Catagory. You can have a link in multiple Catagories by separating them with a '; ').

General Details
Snippet uploaded by: Lhobbs
Email : larry@tstshop.net
Snippet By: Larry Hobbs

<!---Head--->
none

<!---Body--->


<%
' Connection to Database
set conn=CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("databaseLinkDatabase.mdb"))

'Recordset to link table
set rs=CreateObject("ADODB.recordset")
rs.ActiveConnection = conn
rs.Source = "SELECT LinkURL, LinkDescription, LinkCat FROM Link01 ORDER BY LinkDescription"

'Recordset to catagory table
set rsCat=CreateObject("ADODB.recordset")
rsCat.ActiveConnection = conn
rsCat.Source = "SELECT CatKey, CatName, CatDescription FROM Cat01 ORDER BY CatDescription"  

rsCat.Open

do until rsCat.EOF
    'Starting a table with a header titled the catagory
    Response.Write("<table width='200' border='1'>")
    Response.Write("<tr><th>" & rsCat.Fields("CatDescription") & "</th></tr>")
    rs.Open
    do until rs.EOF
        'Load all the links that are in that catagory
        LCat = split(rs.Fields("LinkCat"), ";")
        for i = LBound(LCat) to UBound(LCat)
            if trim(LCat(i)) = trim(rsCat.Fields("CatKey")) then
                'The way the hyperlink is setup, when the user clicks the link, it will go to the site in a new window
                Response.Write ("<tr><td><a href='http://" & rs.Fields("LinkURL") & "' target='_blank'><b>" & rs.Fields("LinkDescription") & "</a></td></tr>")
            end if
        next
        rs.MoveNext
    loop
    rs.Close
    Response.Write("</table>")
    rsCat.MoveNext
    Response.Write("<br>")
loop
rsCat.Close
conn.Close
set rs = nothing
set rsCat = nothing
set conn = nothing
%>




No Reviews to show


Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Subject:

Reviewed By:

Write a review:





Terms of Conditions
Powered By
Avian Hosting
© 2005 snippetlibrary.com All Rights Reserved.