Results 1 to 8 of 8

Thread: What is wrong with this

  1. #1

    Thread Starter
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774

    What is wrong with this

    the first few lines of my asp page are thus


    VB Code:
    1. <%
    2. Function MakeLink(LvLink)
    3. Dim ResultIs
    4. dim MeUrl
    5. ' Where are we?
    6.     MeUrl = Request.ServerVariables("url")
    7.     ResultIs = "<a Href='" & MeUrl & "?Lv=" & LvLink & "'>" & LvLink & "</a>"
    8.     MakeLink = ResultIs
    9. End Function
    10. %>


    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?
    ?
    'What's this bit for anyway?
    For Jono

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    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

  3. #3

    Thread Starter
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    zcon.asp handles the connection


    VB Code:
    1. <%
    2. Function MakeLink(LvLink)
    3. Dim ResultIs
    4. dim MeUrl
    5. ' Where are we?
    6.     MeUrl = Request.ServerVariables("url")
    7.     ResultIs = "<a Href='" & MeUrl & "?Lv=" & LvLink & "'>" & LvLink & "</a>"
    8.     MakeLink = ResultIs
    9. End Function
    10. %>
    11. <html><head></head><body>
    12. <!--#include file="Zcon.asp"-->
    13. <%
    14.  
    15.  
    16. 'The where are we stage
    17.     Dim Lv
    18.     Lv = request.querystring("Lv")
    19.     If Lv="" or isnull(lv) then Lv = "Root"
    20. ' If we don't know / can't find out then we assume the start is the loco'tion
    21.  
    22.  
    23. ' StrSQL stores the SQL for the request it allows us to build a SQL statement
    24. ' and include many variables and alternative
    25. ' SQL code, IFs, loops and so forth
    26.     Dim StrSQL
    27.  
    28. ' The QTable const gives a single location for nameing the query
    29. ' This allows multiple Parent/Child Combo's to be added with only
    30. ' a few name changes
    31.     Const QTable = "[2col]"
    32.  
    33. %>
    34. <table border = '1' width = '100%'>
    35.  
    36. <tr><TD>
    37. <b>
    38. Search >
    39. <%
    40. Dim PathString
    41. pathstring = ""
    42. Dim FirstIs
    43. FirstIs = "... >"
    44.  
    45.  
    46. ' First check we are not at root
    47.     if Lv <> "Root" then
    48.          ' Get the "path to root"
    49.          StrSQL = "SELECT * FROM [5wide] WHERE [finalchild] = '" & Lv & "';"
    50.          Set rsZ = conZ.Execute(StrSQL)
    51.          if not rsZ.eof then
    52.              if rsZ.fields("finalchild") <> "Root" then
    53.                        pathstring = rsZ.fields("finalchild") & pathstring
    54.          Else
    55.                FirstIs = "SEARCH > "
    56.              end if
    57.              if rsZ.fields("P3") <> "Root" then
    58.                        pathstring = MakeLink(rsZ.fields("P3")) & " > " & pathstring
    59.          Else
    60.                FirstIs = "SEARCH > "
    61.              end if
    62.              if rsZ.fields("P2") <> "Root" then
    63.                        pathstring = MakeLink(rsZ.fields("P2")) & " > " & pathstring
    64.          Else
    65.                FirstIs = "SEARCH > "
    66.              end if
    67.              if rsZ.fields("P1") <> "Root" then
    68.                        pathstring = MakeLink(rsZ.fields("P1")) & " > " & pathstring
    69.          Else
    70.                FirstIs = "SEARCH > "
    71.              end if
    72.              if rsZ.fields("Parent") <> "Root" then
    73.                       pathstring = MakeLink(rsZ.fields("Parent")) & " > " & pathstring
    74.          Else
    75.                FirstIs = "SEARCH > "
    76.              end if
    77.              pathstring = FirstIs & pathstring
    78.          end if          
    79.     end if
    80.  
    81. %>
    82. </B>
    83.  </td></tr>
    84. </table>
    85. <%
    86.  
    87. ' Options to choose
    88. ' Where can we go?
    89.  
    90.  
    91. ' Get that data
    92.     StrSQL = "SELECT * FROM " & QTable &  " WHERE Parent = '" & Lv & "' AND child <> 'root'"
    93.     Set rsZ = conZ.Execute(StrSQL)
    94.  
    95. 'Now give the audience the choice
    96.     Do While Not rsZ.EOF
    97.        Response.Write "<BR>"
    98.        Response.Write MakeLink(rsZ.fields("Child"))
    99.        rsZ.MoveNext
    100.     Loop
    101.  
    102.  
    103. ' Close our recordset and connection and dispose of the objects
    104. rsZ.Close
    105. Set rsZ = Nothing
    106. conZ.Close
    107. Set Conz = Nothing
    108.  
    109. ' That's all folks!
    110. %>

    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.
    ?
    'What's this bit for anyway?
    For Jono

  4. #4

    Thread Starter
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    Another question: is there a "better" way to do those IF's a loop of some kind...?

    Couldn they somehow be the problem?
    ?
    'What's this bit for anyway?
    For Jono

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Try removing the single quote ' there.

  6. #6

    Thread Starter
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    Originally posted by mendhak
    Try removing the single quote ' there.
    Pardon me? I don't follow... which one where?
    ?
    'What's this bit for anyway?
    For Jono

  7. #7
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    I think he means.....
    VB Code:
    1. ResultIs = "<a Href='" & MeUrl & "?Lv=" & LvLink & "'>" & LvLink & "</a>"
    Instead of doing it like that, use Chr() codes like this...
    VB Code:
    1. ResultIs = "<a Href=" & Chr(34) & MeUrl & "?Lv=" & LvLink & Chr(34) & ">" & LvLink & "</a>"

  8. #8

    Thread Starter
    Fanatic Member Matt_T_hat's Avatar
    Join Date
    Dec 2001
    Location
    '76 Male Body Evil-Errors: 666
    Posts
    774
    oh I see

    Thankyou, I'll give that a go.
    ?
    'What's this bit for anyway?
    For Jono

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width