Iterating through Application collection

Results 1 to 2 of 2

Thread: Iterating through Application collection

  1. #1
    Join Date
    Dec 1969

    Default Iterating through Application collection

    I&#039;m having trouble with the following snippet of code that is supposed to loop through the collection of Application variables. The code was taken right from, so I&#039;m surprised it doesn&#039;t work. Following the code is the error message I received:<BR><BR>Application("name") = "Application Maker"<BR>Application("publishdate") = "05/15/01"<BR>Application("author") = "DevGuru"<BR>Set Application("Obj1") = Server.CreateObject("ADODB.Connection")<BR> <BR>For Each Item in Application.Contents<BR> If IsObject(Application.Contents(Item)) Then<BR> Response.Write Item & " is an object.<BR>"<BR> Else <BR> Response.Write Item & "=" & Application.Contents(Item) & "<BR>"<BR> End If<BR>Next<BR><BR>Microsoft VBScript runtime error &#039;800a000d&#039; <BR><BR>Type mismatch <BR><BR>/chat_work/new_chat/new_1.asp, line 19 <BR><BR><BR>Thanks,<BR><BR>Jarrod<BR>info@jtwebmas<BR>

  2. #2
    Join Date
    Dec 1969

    Default Dunno what to tell you...

    I copy/pasted your code to a page on my machine (PWS, Win98) and...<BR><BR>it worked just fine!<BR><BR>I even stuffed in an array and a Date object, just for "fun" and they worked.<BR><BR>&#060;HTML&#062;&#060;BODY&#062;<BR ><BR>&#060;%<BR>Application("name") = "Application Maker" <BR>Application("publishdate") = CDate("05/15/01" )<BR>Application("author") = "DevGuru" <BR>Set Application("Obj1") = Server.CreateObject("ADODB.Connection") <BR>Application("anArray") = Array("this","is","a","test")<BR><BR>For Each Item in Application.Contents <BR>&nbsp; &nbsp; Response.Write Item & " is of type " & TypeName(Application(Item))<BR>&nbsp; &nbsp; If IsObject(Application(Item)) Then <BR>&nbsp; &nbsp; &nbsp; &nbsp; Response.Write " and is an object. &lt;BR&#062;"<BR>&nbsp; &nbsp; ElseIf IsArray(Application(Item)) Then<BR>&nbsp; &nbsp; &nbsp; &nbsp; Response.Write " and has contents " & Join(Application(Item),",") & "&lt;BR&#062;"<BR>&nbsp; &nbsp; Else<BR>&nbsp; &nbsp; &nbsp; &nbsp; Response.Write " and has value " & Application.Contents(Item) & "&lt;BR&#062;"<BR>&nbsp; &nbsp; End If <BR>Next <BR>%&#062;<BR>&#060;/BODY&#062;&#060;/HTML&#062;<BR>

Posting Permissions

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