<%
Function MakeLink(LvLink)
Dim ResultIs
dim MeUrl
' Where are we?
MeUrl = Request.ServerVariables("url")
ResultIs = "<a Href='" & MeUrl & "?Lv=" & LvLink & "'>" & LvLink & "</a>"
MakeLink = ResultIs
End Function
%>
<html><head></head><body>
<!--#include file="Zcon.asp"-->
<%
'The where are we stage
Dim Lv
Lv = request.querystring("Lv")
If Lv="" or isnull(lv) then Lv = "Root"
' If we don't know / can't find out then we assume the start is the loco'tion
' StrSQL stores the SQL for the request it allows us to build a SQL statement
' and include many variables and alternative
' SQL code, IFs, loops and so forth
Dim StrSQL
' The QTable const gives a single location for nameing the query
' This allows multiple Parent/Child Combo's to be added with only
' a few name changes
Const QTable = "[2col]"
%>
<table border = '1' width = '100%'>
<tr><TD>
<b>
Search >
<%
Dim PathString
pathstring = ""
Dim FirstIs
FirstIs = "... >"
' First check we are not at root
if Lv <> "Root" then
' Get the "path to root"
StrSQL = "SELECT * FROM [5wide] WHERE [finalchild] = '" & Lv & "';"
Set rsZ = conZ.Execute(StrSQL)
if not rsZ.eof then
if rsZ.fields("finalchild") <> "Root" then
pathstring = rsZ.fields("finalchild") & pathstring
Else
FirstIs = "SEARCH > "
end if
if rsZ.fields("P3") <> "Root" then
pathstring = MakeLink(rsZ.fields("P3")) & " > " & pathstring
Else
FirstIs = "SEARCH > "
end if
if rsZ.fields("P2") <> "Root" then
pathstring = MakeLink(rsZ.fields("P2")) & " > " & pathstring
Else
FirstIs = "SEARCH > "
end if
if rsZ.fields("P1") <> "Root" then
pathstring = MakeLink(rsZ.fields("P1")) & " > " & pathstring
Else
FirstIs = "SEARCH > "
end if
if rsZ.fields("Parent") <> "Root" then
pathstring = MakeLink(rsZ.fields("Parent")) & " > " & pathstring
Else
FirstIs = "SEARCH > "
end if
pathstring = FirstIs & pathstring
end if
end if
%>
</B>
</td></tr>
</table>
<%
' Options to choose
' Where can we go?
' Get that data
StrSQL = "SELECT * FROM " & QTable & " WHERE Parent = '" & Lv & "' AND child <> 'root'"
Set rsZ = conZ.Execute(StrSQL)
'Now give the audience the choice
Do While Not rsZ.EOF
Response.Write "<BR>"
Response.Write MakeLink(rsZ.fields("Child"))
rsZ.MoveNext
Loop
' Close our recordset and connection and dispose of the objects
rsZ.Close
Set rsZ = Nothing
conZ.Close
Set Conz = Nothing
' That's all folks!
%>