468,505 Members | 1,668 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,505 developers. It's quick & easy.

Microsoft VBScript runtime error '800a01b6'

Microsoft VBScript runtime error '800a01b6'

Object required for 'Session(...)'


/OnlineBookStore/AddItemProcess.asp, line 33

I have underlined the error line

Code i Used:
Expand|Select|Wrap|Line Numbers
  1. <%
  2. Dim StrTechName, StrBookName, StrISBN, StrPrice, IntQuantity,
  3. IntCounter, IntCount, IntShowCounter, IntItemID, BlnDuplicate,
  4. IntTotalItems, DblTotalPrice, DblFinalPrice
  5.  
  6. StrTechName = Trim(Request.Form("TechName"))
  7. StrBookName = Trim(Request.Form("BookName"))
  8. StrISBN = Trim(Request.Form("ISBN"))
  9. StrPrice = Trim(Request.Form("Price"))
  10. IntQuantity = Trim(Request.Form("TxtQuantity"))
  11.  
  12. IF Session("LoginBuyer") = "" OR Session("LoginUser") = "" Then
  13. Response.Redirect("Default.asp")
  14. END IF
  15.  
  16. BlnDuplicate = False
  17.  
  18. IntCount = CInt(Session("TotalItems"))
  19.  
  20. IF IntCount > 0 Then
  21.         For IntCounter = 1 to IntCount
  22.         IF Session("MyItems")("ISBN" & IntCounter) = StrISBN And Session
  23. ("MyItems")("Purchase" & IntCounter) = "yes" Then
  24.         BlnDuplicate = True
  25.         Exit For
  26.         END IF
  27.         Next
  28. END IF
  29.  
  30. IF BlnDuplicate = True Then
  31. IntQuantity = IntQuantity + CInt(Session("MyItems")("Quantity" &
  32. IntCounter))
  33. Session("MyItems")("Quantity" & IntCounter) = IntQuantity
  34. ELSE
  35. IntItemID = CInt(Session("TotalItems"))
  36. IntItemID = IntItemID + 1
  37. Session("MyItems").Add "BookName" & IntItemID, StrBookName
  38. Session("MyItems").Add "ISBN" & IntItemID, StrISBN
  39. Session("MyItems").Add "Price" & IntItemID, StrPrice
  40. Session("MyItems").Add "Quantity" & IntItemID, IntQuantity
  41. Session("MyItems").Add "Purchase" & IntItemID, "yes"
  42. Session("TotalItems") = Session("TotalItems") + 1
  43. END IF
  44. %>
  45.  
  46. <table border="0">
  47.         <tr>
  48.                 <td><h3><font face="verdana, arial" color="darkblue">Item Added In
  49. Your Cart!</font></h3></td>
  50.         </tr>
  51. </table>
  52. <hr color="black" noshade>
  53. <table border="0">
  54.         <tr>
  55.                 <td class="SimpleText">You are in <b><%= StrTechName %></b>
  56. category.</td>
  57.         </tr>
  58. </table>
  59. <table border="1" bordercolor="lightgrey" style="border-
  60. collapse:collapse">
  61.         <tr>
  62.                 <td class="SimpleText"><b>Book Name</b></td>
  63.                 <td class="SimpleText"><b>ISBN</b></td>
  64.                 <td class="SimpleText"><b>Quantity</b></td>
  65.                 <td class="SimpleText"><b>Price</b></td>
  66.                 <td class="SimpleText"><b>Total Price</b></td>
  67.                 <td class="SimpleText"><b>Option</b></td>
  68.         </tr>
  69.         <%
  70.                 IntCount = CInt(Session("TotalItems"))
  71.                 For IntShowCounter = 1 to IntCount
  72.                 IF Session("MyItems")("Purchase" & IntShowCounter) = "yes" Then
  73.                 IntTotalItems = IntTotalItems + 1
  74.                 DblTotalPrice = CDbl(Session("MyItems")("Price" & IntShowCounter) *
  75. CInt(Session("MyItems")("Quantity" & IntShowCounter)))
  76.                 DblFinalPrice = DblFinalPrice + CDbl(DblTotalPrice)
  77.         %>
  78.         <tr>
  79.                 <td class="SimpleText"><%= Session("MyItems")("BookName" &
  80. IntShowCounter) %></td>
  81.                 <td class="SimpleText"><%= Session("MyItems")("ISBN" &
  82. IntShowCounter) %></td>
  83.                 <td class="SimpleText"><%= Session("MyItems")("Quantity" &
  84. IntShowCounter) %></td>
  85.                 <td class="SimpleText"><%= Session("MyItems")("Price" &
  86. IntShowCounter) %></td>
  87.                 <td class="SimpleText"><%= CDbl(DblTotalPrice) %></td>
  88.                 <td><a href="RemoveItem.asp?ISBN=<%= Session("MyItems")("ISBN" &
  89. IntShowCounter) %>" class="NormalLink">Remove Item</a></td>
  90.         </tr>
  91.         <%
  92.                 END IF
  93.                 Next
  94.         %>
  95. </table>
  96. <hr color="black" noshade>
  97. <table border="1" bordercolor="lightgrey" style="border-
  98. collapse:collapse">
  99.         <tr>
  100.                 <td class="SimpleText">Total items in your cart: <b><%=
  101. IntTotalItems %></b></td>
  102.         </tr>
  103.         <tr>
  104.                 <td class="SimpleText">Total cost of all items: <b><%= CDbl
  105. (DblFinalPrice) %></b></td>
  106.         </tr>
  107.         <%
  108.                 IF IntTotalItems > 0 Then
  109.         %>
  110.         <tr>
  111.                 <td><a href="SubmitOrder.asp" class="NormalLink">Submit My Order</
  112. a></td>
  113.         </tr>
  114.         <%
  115.                 END IF
  116.         %>
  117. </table> 
  118.  
Please guys get me the solution for this...
Its urgent...
Mar 13 '10 #1
6 5253
jhardman
3,405 Expert 2GB
I don't see anything underlined. Where is the error?

Jared
Mar 25 '10 #2
jhardman
3,405 Expert 2GB
Pls See the line 37

Session("MyItems").Add "BookName" & IntItemID, StrBookName


Sir, Now it show the following error


HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

Technical Information (for support personnel)
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'Session(...)'
/tilak/AddItemProcess.asp, line 37

Browser Type:
Opera/9.63 (Windows NT 5.1; U; en) Presto/2.1.1

Page:
POST 90 bytes to /tilak/AddItem.asp

POST Data:
TechName=Nokia&BookName=NOKIA7420&Price=8000&Mobil eID=4&TxtQuantity=2&submit=Add+This+Item


Pls sir, get me the solution for this.....
You accidentally sent your reply as a private message instead of putting it in the thread. I am including it here.

Jared
Mar 28 '10 #3
jhardman
3,405 Expert 2GB
right before that line, add this to test what you have:
Expand|Select|Wrap|Line Numbers
  1. for each x in session("myItems")
  2.    response.write x.name & ": " & x.value & "<br>" % vbNewLine
  3. next
Jared
Mar 28 '10 #4
Nicodemas
164 Expert 100+
The session variable in ASP is not a collection. The .Add() command is probably the problem.

At the same time, though, it depends on the vartype of the session variable. Can you tell me that?
Mar 30 '10 #5
The data type of session variable is varient type....
Apr 2 '10 #6
Nicodemas
164 Expert 100+
Variant indicates that the session variable is an array. The Add() will not work, unfortunately.

You have to determine the ubound, and if your new addition would exceed the ubound, you have to redim the array (preserving the contents using keyword 'preserve') to the new ubound (old ubound + 1), then assign the new value to the highest index.
Apr 2 '10 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by =?Utf-8?B?TWF0dCBDYWxob29u?= | last post: by
reply views Thread by NPC403 | last post: by
3 posts views Thread by gieforce | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.