Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Microsoft VBScript runtime (0x800A000D) Type mismatch getting session.content

Posted on 2009-02-18
5
Medium Priority
?
420 Views
Last Modified: 2012-05-06
For Each Item in Session.Contents
Getting this error using cint(i) or cstr(i).  If I hard code numbers for "i" in Contents(i) I get the value, however, it doesn't like the i incremented.  Any ideas thanks in advanced.

-C
For Each Item in Session.Contents
i = 1
    If IsObject( Session.Contents(Item)) Then
      Response.Write Item & " is an object.<BR>"
    Else
      Response.Write Item & "=" & Session.Contents(i) & "<BR>"
    End If
i=i+1
Next

Open in new window

0
Comment
Question by:czlong
5 Comments
 
LVL 20

Accepted Solution

by:
hes earned 2000 total points
ID: 23675736
Have a look here:

http://www.4guysfromrolla.com/webtech/tips/t030100-1.shtml

at the function

 function dumpItem(item)
        'If it's an array we use this to iterate through it
        dim subItem
        dim result  'Will store the result

        'If it's an array we have to
        'grab its contents.  
        if TypeName(item) = "Variant()" then
          for each subItem in item
             'Separate each with a space
             result = result & " " & subItem
          next
        else
          result = item
        end if

        dumpItem = result
    end function
0
 
LVL 12

Expert Comment

by:Krys_K
ID: 23675779
Hi

Can you show the whole loop so i can see what is happening and how you are using teh variables etc.

Thanks
Krystian
0
 
LVL 14

Expert Comment

by:rejoinder
ID: 23675782
Try this
i = 0
For Each Item in Session.Contents
        If IsObject( Session.Contents(Item) ) Then
            Response.Write Item & " is an object.<BR>"
        Else
            Response.Write Item & "=" & Session.Contents(i) & "<BR>"
        End If
    i=i+1
Next

Open in new window

0
 
LVL 12

Expert Comment

by:Krys_K
ID: 23675910
Should it not be
Response.Write Item & "=" & Session.Contents(Item) & "<BR>"

Regards
Krystian
0
 

Author Closing Comment

by:czlong
ID: 31548518
This works. I tried the other solutions and this was the one that worked.

Thanks much!
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question