|
-
Jan 3rd, 2004, 10:34 AM
#1
Thread Starter
Fanatic Member
What is wrong with this
the first few lines of my asp page are thus
VB Code:
<%
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
%>
it produces this:
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/thehat/test/dev1/Zcon.asp, line 9
but I can not see what is wrong... anyone have an idea?
-
Jan 3rd, 2004, 10:44 AM
#2
Frenzied Member
your function above works fine...What are you passing it???
is that the only code in the Zcon.asp page?
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Jan 3rd, 2004, 11:45 AM
#3
Thread Starter
Fanatic Member
zcon.asp handles the connection
VB Code:
<%
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!
%>
I know that the include works and I did have it going fairly well.
Last edited by Matt_T_hat; Jan 3rd, 2004 at 11:48 AM.
-
Jan 6th, 2004, 07:50 AM
#4
Thread Starter
Fanatic Member
Another question: is there a "better" way to do those IF's a loop of some kind...?
Couldn they somehow be the problem?
-
Jan 6th, 2004, 10:07 AM
#5
Try removing the single quote ' there.
-
Jan 6th, 2004, 05:58 PM
#6
Thread Starter
Fanatic Member
Originally posted by mendhak
Try removing the single quote ' there.
Pardon me? I don't follow... which one where?
-
Jan 7th, 2004, 07:01 AM
#7
Frenzied Member
I think he means.....
VB Code:
ResultIs = "<a Href='" & MeUrl & "?Lv=" & LvLink & "'>" & LvLink & "</a>"
Instead of doing it like that, use Chr() codes like this...
VB Code:
ResultIs = "<a Href=" & Chr(34) & MeUrl & "?Lv=" & LvLink & Chr(34) & ">" & LvLink & "</a>"
-
Jan 14th, 2004, 09:44 AM
#8
Thread Starter
Fanatic Member
oh I see
Thankyou, I'll give that a go.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|