ID: 528
Viewed: 3530
Added: Sep 01, 2004
Version: unknown
Snippet uploaded by: Lhobbs
Written By: Larry Hobbs
Demo: Sorry, no demo
Thank you for your vote. Please wait...
It appears you already voted for this snippet
It appears your vote value was empty
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 '; ').
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 '; ').
<!---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 Comments to show
Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.
Adding your comment. Please wait...
Thanks for adding your comment!. After further review it will be added.
There was a problem adding your comment. Please try again.
Please complete all the fields in the form before sending.