Connect with Expertise | Find Experts, Get Answers, Share Insights

Microsoft VBScript runtime error '800a01b6'

 
Join Date: Feb 2010
Location: Coimbatore
Posts: 9
#1: Mar 13 '10
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...

jhardman's Avatar
E
M
C
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,967
#2: Mar 25 '10

re: Microsoft VBScript runtime error '800a01b6'


I don't see anything underlined. Where is the error?

Jared
jhardman's Avatar
E
M
C
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,967
#3: Mar 28 '10

re: Microsoft VBScript runtime error '800a01b6'


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
jhardman's Avatar
E
M
C
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,967
#4: Mar 28 '10

re: Microsoft VBScript runtime error '800a01b6'


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
E
C
 
Join Date: Nov 2007
Posts: 134
#5: Mar 30 '10

re: Microsoft VBScript runtime error '800a01b6'


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?
 
Join Date: Feb 2010
Location: Coimbatore
Posts: 9
#6: Apr 2 '10

re: Microsoft VBScript runtime error '800a01b6'


The data type of session variable is varient type....
E
C
 
Join Date: Nov 2007
Posts: 134
#7: Apr 2 '10

re: Microsoft VBScript runtime error '800a01b6'


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.
Reply