473,385 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Microsoft VBScript Runtime Error!!

10
Can anyone help in figuring out what is wrong with the script below:

Expand|Select|Wrap|Line Numbers
  1. For I = 0 To UBound(arrArray)
  2. If Val(arrArray(I)) = Val(varValue) Then
  3. Array_Exists = True
  4. Exit Function
  5. End If
  6. Next
  7. Array_Exists = False
  8. End Function
The accompanying error is

Microsoft VBScript runtime error '800a001c'

Out of stack space: 'Val'

Any info will be really appreciated.
Thanks.
May 14 '07 #1
11 6320
Denburt
1,356 Expert 1GB
Well to kick this off are you sure you are sending a string to the val function? Personally I don't understand what your trying to do in this procedure however I would say to verify the info in both of the val functions to verify they are strings or convert them before trying to utilize that function. Use debug.print to verify that they have a value to start with then go from there.
May 14 '07 #2
Killer42
8,435 Expert 8TB
I'd have to agree with Denburt. Unless you have somehow created reentrant code, I don't see how you could be running out of stack space. So perhaps you are passing some sort of really weird value to the Val() function.

If possible, I'd recommend you interrupt the code at the point where the error occurs, and examine the variables involved directly, rather than relying on Debug.Print (though that will probably be good enough, too). At the very least, it will be good debugging practice. :)
May 15 '07 #3
tashy
10
Thanks for the replies. Perhaps I didn't clarify myself very well. I've never written a code before. What I wanted to do was edit my website, when I got this error:

Microsoft VBScript runtime error '800a001c'

Out of stack space: 'Val'

/admin/content/pages.asp, line 7

Let me paste the folder in question, then perhaps you can tell me where I have to insert something.
Here we go:

Expand|Select|Wrap|Line Numbers
  1. <!-- #include virtual="/includes/common.asp" -->
  2. <%
  3. Function Array_Exists(arrArray, varValue)
  4.     Dim I
  5.  
  6.     For I = 0 To UBound(arrArray)
  7.         If Val(arrArray(I)) = Val(varValue) Then
  8.             Array_Exists = True
  9.             Exit Function
  10.         End If
  11.     Next
  12.     Array_Exists = False
  13. End Function
  14.  
  15. Function GetExpandedPagesArray(arrPages, lngActivePageID, bolExpandLast)
  16.     GetExpandedPagesArray = Split(GetExpandedPagesCSV(arrPages, lngActivePageID, bolExpandLast), ",")
  17. End Function
  18.  
  19. Function GetExpandedPagesCSV(arrPages, lngActivePageID, bolExpandLast)
  20.     Dim lngParentPageID, I, strTemp
  21.  
  22.     If bolExpandLast Then
  23.         strTemp = lngActivePageID
  24.     End If
  25.     For I = 0 To UBound(arrPages, 2)
  26.         If arrPages(0, I) = lngActivePageID Then
  27.             lngParentPageID = arrPages(1, I)
  28.             If lngParentPageID > 0 Then
  29.                 strTemp = strTemp & IIf(strTemp = "", "", ",") & GetExpandedPagesCSV(arrPages, lngParentPageID, True)
  30.             End If
  31.         End If
  32.     Next
  33.     GetExpandedPagesCSV = strTemp
  34. End Function
  35.  
  36. Sub BuildTree(objTree, arrPages, lngParentPageID)
  37.     Dim I, strParentKey, strLinkText, strIcon
  38.  
  39.     For I = 0 To UBound(arrPages, 2)
  40.         If arrPages(1, I) = lngParentPageID Then
  41.             strParentKey = IIf(lngParentPageID = 0, "root", "page" & lngParentPageID)
  42.             strLinkText = arrPages(2, I)
  43.             If Not arrPages(3, I) Then strLinkText = "<font color=""#777777"">" & strLinkText & "</font>"
  44.             If lngParentPageID = 0 Then strLinkText = "<b>" & strLinkText & "</b>"
  45.             If IsNull(arrPages(5, I)) Then
  46.                 If arrPages(4, I) = "" Then
  47.                     strIcon = "page.gif"
  48.                 Else
  49.                     strIcon = "link.gif"
  50.                 End If
  51.             Else
  52.                 strIcon = arrPages(5, I)
  53.             End If
  54.             strLinkText = "<a href=""page.asp?id=" & arrPages(0, I) & """ target=""edit"" onclick=""ob_ft(this.parentElement);"" oncontextmenu=""ob_ft(this.parentElement); ShowPageMenu(" & arrPages(0, I) & ",this); return false;"">" & strLinkText & "</a>"
  55.  
  56.             objTree.Add strParentKey, "page" & arrPages(0, I), strLinkText, Array_Exists(arrExpanded, arrPages(0, I)), strIcon
  57.             BuildTree objTree, arrPages, arrPages(0, I)
  58.         End If
  59.     Next
  60. End Sub
  61.  
  62. lngParentPageID = Val(Request("parentpageid"))
  63. lngPageID = Val(Request("pageid"))
  64.  
  65. strSQL = _
  66.     "SELECT P.ID, P.ParentPageID, P.Title, P.ShowInMenu, P.RedirectURL, T.Icon " & _
  67.     "FROM Pages P " & _
  68.     "LEFT OUTER JOIN PageTemplates T ON T.ID=P.TemplateID " & _
  69.     "WHERE P.DateDeleted IS NULL " & _
  70.     "ORDER BY SortOrder"
  71. Set rsPages = objConn.Execute(strSQL)
  72. arrPages = rsPages.GetRows()
  73.  
  74. arrExpanded = GetExpandedPagesArray(arrPages, lngParentPageID, True)
  75.  
  76. Set objTree = Server.CreateObject("obout_asptreeview_pro.tree")
  77. objTree.Add "", "root", "pensionsraadgivere.dk", True, "ie_link.gif"
  78. BuildTree objTree, arrPages, 0
  79. If lngPageID > 0 Then
  80.     objTree.SelectedNode_Id = "page" & lngPageID
  81. End If
  82. objTree.SelectedNode_Enable = False
  83. strHTML = objTree.HTML
  84. strHTML = Replace(strHTML, "<table cellspacing=5 cellpadding=5 border=1><tr><td style=""font:11px verdana;"" align=center>&nbsp;<br><a href=""http://www.ASPTreeView.com"">www.ASPTreeView.com</a> <br>&nbsp;<br> Evaluation has expired<br>&nbsp;<br><a href=""http://www.obout.com/obout/treeview/xp_treeview.asp#tableLicense""> Purchase info </a><br>&nbsp;</td></tr></td></tr></table>", "")
  85. %>
  86. <!-- #include virtual="/includes/adminframepagetop.asp" -->
  87. <script>
  88.     var lngSelectedPageID = 0;
  89.  
  90.     function ShowPageMenu(lngPageID) {
  91.         lngSelectedPageID = lngPageID;
  92.         document.PopupMenu.popup(event.x,event.y);
  93.     }
  94.  
  95.     function OpenPage() {
  96.         parent.frames["edit"].navigate("page.asp?id="+lngSelectedPageID)
  97.     }
  98.  
  99.     function NewPage() {
  100.         parent.frames["edit"].navigate("page.asp?parentpageid="+lngSelectedPageID)
  101.     }
  102.  
  103.     function MovePageUp() {
  104.         parent.frames["edit"].navigate("page.asp?mode=move&dir=-1&id="+lngSelectedPageID)
  105.     }
  106.  
  107.     function MovePageDown() {
  108.         parent.frames["edit"].navigate("page.asp?mode=move&dir=1&id="+lngSelectedPageID)
  109.     }
  110.  
  111.     function DeletePage() {
  112.         if (sure()) {
  113.             parent.frames["edit"].navigate("page.asp?mode=delete&id="+lngSelectedPageID)
  114.         }
  115.     }
  116.  
  117. </script>
  118. <APPLET
  119. NAME = "PopupMenu"
  120. CODE = "PopupMenuApplet.class"
  121. CODEBASE= "/admin/"
  122. WIDTH= "0"
  123. HEIGHT= "0"
  124. MAYSCRIPT
  125. >
  126.  
  127. <PARAM NAME="DATA" VALUE="
  128. {Åbn*javascript:OpenPage()*}
  129. {HR}
  130. {Ny underside...*javascript:NewPage()*}
  131. {HR}
  132. {Flyt op*javascript:MovePageUp()*}
  133. {Flyt ned*javascript:MovePageDown()*}
  134. {HR}
  135. {Slet*javascript:DeletePage()*}
  136. ">
  137.  
  138. </APPLET><br>
  139. <table width="100%" border="0" cellspacing="0" cellpadding="3">
  140.     <tr>
  141.         <td>
  142.             <%= strHTML %>
  143.         </td>
  144.     </tr>
  145. </table>
  146. <!-- #include virtual="/includes/adminframepagebottom.asp" -->
May 15 '07 #4
Denburt
1,356 Expert 1GB
I would start somewhere around line 71... This code is pretty sloppy (no offense) but I can try to help.

The code is opening a recordset here but there are no checks in place to verify that the recordset has any records. This is one reason you may be getting your error. Even if it isn't I would at least try to put a check in here to make sure it won't happen.
Expand|Select|Wrap|Line Numbers
  1. Set rsPages = objConn.Execute(strSQL)
  2. 'Something like this:
  3. If rsPages.eof then exit Function
  4. arrPages = rsPages.GetRows()
  5. arrExpanded
This code appears to have many issues such as this but start here and just clean it up let us know whether this helps.
May 15 '07 #5
tashy
10
Now it gives this error:

Microsoft VBScript compilation error '800a040f'

Invalid 'exit' statement

/admin/content/pages.asp, line 72

If rsPages.eof then exit



Did you say there was nothing wrong with line 7? That seems to be where the initial error came from.
May 15 '07 #6
danp129
323 Expert 256MB
The Exit function doesn't work becuase your not in a function (not in a sub either) So you'll have to do something like this for that section of the code:

Expand|Select|Wrap|Line Numbers
  1. Set rsPages = objConn.Execute(strSQL)
  2. if not rsPages.EOF then
  3.     arrPages = rsPages.GetRows()
  4.     arrExpanded = GetExpandedPagesArray(arrPages, lngParentPageID, True)
  5.  
  6.     Set objTree = Server.CreateObject("obout_asptreeview_pro.tree")
  7.     objTree.Add "", "root", "pensionsraadgivere.dk", True, "ie_link.gif"
  8.     BuildTree objTree, arrPages, 0
  9.     If lngPageID > 0 Then
  10.      objTree.SelectedNode_Id = "page" & lngPageID
  11.     End If
  12.     objTree.SelectedNode_Enable = False
  13. end if
  14. strHTML = objTree.HTML
  15. strHTML = Replace(strHTML, "<table cellspacing=5 cellpadding=5 border=1><tr><td style=""font:11px verdana;"" align=center>&nbsp;<br><a href=""http://www.ASPTreeView.com"">www.ASPTreeView.com</a> <br>&nbsp;<br> Evaluation has expired<br>&nbsp;<br><a href=""http://www.obout.com/obout/treeview/xp_treeview.asp#tableLicense""> Purchase info</a><br>&nbsp;</td></tr></td></tr></table>", "")
May 15 '07 #7
Denburt
1,356 Expert 1GB
I just reviewed the code earlier and thought it was in a function however this is not the case it appears to be stand alone code that runs when the page opens.

Try adding an if statement similar to what I provided checking to see that it isn't EOF if it isn't then run the rest of the code:

Expand|Select|Wrap|Line Numbers
  1. <!-- #include virtual="/includes/common.asp" -->
  2. <%
  3. Function Array_Exists(arrArray, varValue)
  4.     Dim I
  5.  
  6.     For I = 0 To UBound(arrArray)
  7.         If Val(arrArray(I)) = Val(varValue) Then
  8.             Array_Exists = True
  9.             Exit Function
  10.         End If
  11.     Next
  12.     Array_Exists = False
  13. End Function
  14.  
  15. Function GetExpandedPagesArray(arrPages, lngActivePageID, bolExpandLast)
  16.     GetExpandedPagesArray = Split(GetExpandedPagesCSV(arrPages, lngActivePageID, bolExpandLast), ",")
  17. End Function
  18.  
  19. Function GetExpandedPagesCSV(arrPages, lngActivePageID, bolExpandLast)
  20.     Dim lngParentPageID, I, strTemp
  21.  
  22.     If bolExpandLast Then
  23.         strTemp = lngActivePageID
  24.     End If
  25.     For I = 0 To UBound(arrPages, 2)
  26.         If arrPages(0, I) = lngActivePageID Then
  27.             lngParentPageID = arrPages(1, I)
  28.             If lngParentPageID > 0 Then
  29.                 strTemp = strTemp & IIf(strTemp = "", "", ",") & GetExpandedPagesCSV(arrPages, lngParentPageID, True)
  30.             End If
  31.         End If
  32.     Next
  33.     GetExpandedPagesCSV = strTemp
  34. End Function
  35.  
  36. Sub BuildTree(objTree, arrPages, lngParentPageID)
  37.     Dim I, strParentKey, strLinkText, strIcon
  38.  
  39.     For I = 0 To UBound(arrPages, 2)
  40.         If arrPages(1, I) = lngParentPageID Then
  41.             strParentKey = IIf(lngParentPageID = 0, "root", "page" & lngParentPageID)
  42.             strLinkText = arrPages(2, I)
  43.             If Not arrPages(3, I) Then strLinkText = "<font color=""#777777"">" & strLinkText & "</font>"
  44.             If lngParentPageID = 0 Then strLinkText = "<b>" & strLinkText & "</b>"
  45.             If IsNull(arrPages(5, I)) Then
  46.                 If arrPages(4, I) = "" Then
  47.                     strIcon = "page.gif"
  48.                 Else
  49.                     strIcon = "link.gif"
  50.                 End If
  51.             Else
  52.                 strIcon = arrPages(5, I)
  53.             End If
  54.             strLinkText = "<a href=""page.asp?id=" & arrPages(0, I) & """ target=""edit"" onclick=""ob_ft(this.parentElement);"" oncontextmenu=""ob_ft(this.parentElement); ShowPageMenu(" & arrPages(0, I) & ",this); return false;"">" & strLinkText & "</a>"
  55.  
  56.             objTree.Add strParentKey, "page" & arrPages(0, I), strLinkText, Array_Exists(arrExpanded, arrPages(0, I)), strIcon
  57.             BuildTree objTree, arrPages, arrPages(0, I)
  58.         End If
  59.     Next
  60. End Sub
  61.  
  62. lngParentPageID = Val(Request("parentpageid"))
  63. lngPageID = Val(Request("pageid"))
  64.  
  65. strSQL = _
  66.     "SELECT P.ID, P.ParentPageID, P.Title, P.ShowInMenu, P.RedirectURL, T.Icon " & _
  67.     "FROM Pages P " & _
  68.     "LEFT OUTER JOIN PageTemplates T ON T.ID=P.TemplateID " & _
  69.     "WHERE P.DateDeleted IS NULL " & _
  70.     "ORDER BY SortOrder"
  71. Set rsPages = objConn.Execute(strSQL)
  72. If not rsPages.EOF then
  73. arrPages = rsPages.GetRows()
  74.  
  75. arrExpanded = GetExpandedPagesArray(arrPages, lngParentPageID, True)
  76.  
  77. Set objTree = Server.CreateObject("obout_asptreeview_pro.tree")
  78. objTree.Add "", "root", "pensionsraadgivere.dk", True, "ie_link.gif"
  79. BuildTree objTree, arrPages, 0
  80. If lngPageID > 0 Then
  81.     objTree.SelectedNode_Id = "page" & lngPageID
  82. End If
  83. objTree.SelectedNode_Enable = False
  84. strHTML = objTree.HTML
  85. strHTML = Replace(strHTML, "<table cellspacing=5 cellpadding=5 border=1><tr><td style=""font:11px verdana;"" align=center>&nbsp;<br><a href=""http://www.ASPTreeView.com"">www.ASPTreeView.com</a> <br>&nbsp;<br> Evaluation has expired<br>&nbsp;<br><a href=""http://www.obout.com/obout/treeview/xp_treeview.asp#tableLicense""> Purchase info </a><br>&nbsp;</td></tr></td></tr></table>", "")
  86.  
  87. Else
  88. Response.Write "<p>No records found</p>"
  89. End IF
  90. %>
  91. <!-- #include virtual="/includes/adminframepagetop.asp" -->
  92. <script>
  93.     var lngSelectedPageID = 0;
  94.  
  95.     function ShowPageMenu(lngPageID) {
  96.         lngSelectedPageID = lngPageID;
  97.         document.PopupMenu.popup(event.x,event.y);
  98.     }
  99.  
  100.     function OpenPage() {
  101.         parent.frames["edit"].navigate("page.asp?id="+lngSelectedPageID)
  102.     }
  103.  
  104.     function NewPage() {
  105.         parent.frames["edit"].navigate("page.asp?parentpageid="+lngSelectedPageID)
  106.     }
  107.  
  108.     function MovePageUp() {
  109.         parent.frames["edit"].navigate("page.asp?mode=move&dir=-1&id="+lngSelectedPageID)
  110.     }
  111.  
  112.     function MovePageDown() {
  113.         parent.frames["edit"].navigate("page.asp?mode=move&dir=1&id="+lngSelectedPageID)
  114.     }
  115.  
  116.     function DeletePage() {
  117.         if (sure()) {
  118.             parent.frames["edit"].navigate("page.asp?mode=delete&id="+lngSelectedPageID)
  119.         }
  120.     }
  121.  
  122. </script>
  123. <APPLET
  124. NAME = "PopupMenu"
  125. CODE = "PopupMenuApplet.class"
  126. CODEBASE= "/admin/"
  127. WIDTH= "0"
  128. HEIGHT= "0"
  129. MAYSCRIPT
  130. >
  131.  
  132. <PARAM NAME="DATA" VALUE="
  133. {Åbn*javascript:OpenPage()*}
  134. {HR}
  135. {Ny underside...*javascript:NewPage()*}
  136. {HR}
  137. {Flyt op*javascript:MovePageUp()*}
  138. {Flyt ned*javascript:MovePageDown()*}
  139. {HR}
  140. {Slet*javascript:DeletePage()*}
  141. ">
  142.  
  143. </APPLET><br>
  144. <table width="100%" border="0" cellspacing="0" cellpadding="3">
  145.     <tr>
  146.         <td>
  147.             <%= strHTML %>
  148.         </td>
  149.     </tr>
  150. </table>
  151. <!-- #include virtual="/includes/adminframepagebottom.asp" -->
[/quote]
May 15 '07 #8
tashy
10
Microsoft VBScript compilation error '800a03f6'

Expected 'End'

/admin/content/pages.asp, line 143




Current error.
May 15 '07 #9
Denburt
1,356 Expert 1GB
I just noticed danP managed a post while I was typing earlier. So you tried his post or mine or both? danP you are correct about it not being in a function and thank you for correcting me (I just noticed). The "end if" must reside after the objttree references or you will see an error when the recordset is EOF. You might exchange response.Write in my code for something to the effect of:

Expand|Select|Wrap|Line Numbers
  1. strHTML ="<p>No data found for the selected information</p>"
May 15 '07 #10
Killer42
8,435 Expert 8TB
Do you guys feel I should throw this over to the ASP forum, or what?
May 15 '07 #11
Denburt
1,356 Expert 1GB
Do you guys feel I should throw this over to the ASP forum, or what?
Done! It's now in the ASP forum.
May 16 '07 #12

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

Similar topics

10
by: | last post by:
I am accessing the same error-containing ASP page on an ISP server using w2k IE6 but with different effect. On the first computer I get several line of HTML outputed by ASP, shown correctly by...
3
by: Mike Kanski | last post by:
I get this error Microsoft VBScript runtime error '800a01fb' When i call LoadPicture method, or when i pretty much do any operation with PictureBox like setting width and height. It happened...
10
by: Seeker | last post by:
Hi! I have to do some developing and I'm trying to configure my server to mimic the operation of our production server. The issue I'm having is that I'm trying to use CDONTS to send an email...
1
by: Matrix | last post by:
I just got one virtual directory setup and try to run my web application from there. I am getting following error Microsoft VBScript runtime error '800a01a8' Object required: 'Session' I even...
1
by: PaulieS | last post by:
Hi all. Am migrating a customer from IIS5 on W2K server to IIS6 on W2K3. Zipped all the websites and unzipped them to the identical locations on new server. Used IISMT to migrate metabase. ...
2
by: anidmarty | last post by:
Hey I'm a Sysadmin and my users are getting this error on my production box. It works fine on the dev box. There is a script that is run that generates this error. Production is clustered...
0
by: =?Utf-8?B?TWF0dCBDYWxob29u?= | last post by:
HI there, I am getting an error on my page which calls up a web service. Microsoft VBScript runtime error '800a13ba' Unknown runtime error: 'SearchQueryXML' /SearchResults.asp, line 142
1
by: Concheso | last post by:
Hi there! I just created a login page. 1/3 of the login works fine, but some like "Lost Password" of "Admin access to add users" are not working. Any help will be great! The erros: On...
0
by: .nLL | last post by:
Erorr is --------------------- Microsoft VBScript runtime error '800a0046' Permission denied /a.asp, line 3 -----------------------
1
by: morrisqueto | last post by:
Hello, One of my websites just started sending a new rare error. The site has been working for almost 2 years without trouble, but today morning started giving away this error in all my views. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.