ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old April 14th, 2008, 03:46 PM
elkehinze's Avatar
elkehinze elkehinze is online now
The Queen of Typos
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2004
Location: Two Rivers, WI
Posts: 1,140 elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level)elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level)elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level)elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level)elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level)elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 12 h 19 m 56 sec
Reputation Power: 46
Send a message via ICQ to elkehinze Send a message via AIM to elkehinze Send a message via MSN to elkehinze Send a message via Yahoo to elkehinze
Stumped Getting Out of Memory Error

I'm creating some menus based on a recursive menu script I got from here

I have modified it to use a SQL database as well as a jquery nested menu which works similarly to suckerfish dropdowns.

What I want the script to do is to recursively go through the list and when there is a child display it. My version works just fine the first go around but then fails once it's called a second time.

I can't show you the link because it's on our internal server, but here is my code:

Code:
sub listParentMenu()
	strSQL = "SELECT menuID, parentMenuName, levels" &_
	         " FROM menus" &_
	         " WHERE levels = 1" &_
	         " ORDER BY menuID"
	         
	set objRS = GetDisconnectedRecordset(strSQL, "GetMenus", false)	  
	    Response.Write "<ul id=""main-nav"" class=""ul_bg"">" & vbcrlf
		While NOT objRS.EOF
			Response.Write "<li class=""down_arrow"">" & objRS("parentMenuName") & "" &vbcrlf
			
			Call listChildMenu(objRS("parentMenuName"))
			
			objRS.MoveNext()
            			 
			Response.Write Space(2) & "</li>" & vbCRLF
		Wend
		Response.Write "</ul>" & vbcrlf

		
	objRS.Close()
end sub
	
Sub listChildMenu(parMenuName)
	strSQL2 = "SELECT menu1.menuID as menuID, menu1.parentMenuName as menuName, " &_
	          " menu1.childMenuName as childMenuName, menu1.Link as link, menu1.Levels as lvl, " &_
	          " menu1.isParent as isParent FROM menus menu1" &_
	          " INNER JOIN menus as menu2 ON menu1.menuID = menu2.menuID" &_
	          " WHERE menu2.parentMenuName = '"&parMenuName&"'" &_
	          " AND menu1.childMenuName <> '' " &_
	          " ORDER BY menu1.menuID"
     
	Set objRS2 = GetDisconnectedRecordset(strSQL2, "GetChildrenMenus", false)	  
   
   	If Not objRS2.EOF Or Not objRS2.BOF Then
      Response.Write Space(2) & "<ul class=""childLevel"">" & vbcrlf
      While not objRS2.EOF
	      Response.Write Space(4) & "<li"
	       if (objRS2("isParent") = "True") then 
	        Response.write " class=""next_arrow"" "
	       end if 
	      Response.write "><a href="""&objRS2("link")&""">"&objRS2("childMenuName")&"</a>" &vbcrlf
	      
	      Call listChildMenu(objRS2("menuName"))
	      
	      Response.Write "</li>"&vbcrlf
          objRS2.MoveNext()
      Wend
      Response.write Space(4) & "</ul>" &vbcrlf
    end if
    objRS2.Close()
    set objRS2 = Nothing
End Sub

<% Call listParentMenu() %>


I'm pretty sure it's failing when I call the listChildMenu sub again.

This is the error I'm getting:

Quote:
Microsoft VBScript runtime (0x800A0007)
Out of memory: 'Raise'
__________________

Reply With Quote
  #2  
Old April 14th, 2008, 05:10 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,713 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 23 h 57 m 59 sec
Reputation Power: 688
I don't see where you close or exit the parent menu sub. Or what will happen if you call that sub while your rs is already at EOF.
__________________
======
Doug G
======
"Hide, hide witch! The good folk come to burn thee. Their keen enjoyment hid behind their gothic mask of duty." -Mark Clifton

Reply With Quote
  #3  
Old April 15th, 2008, 11:35 AM
elkehinze's Avatar
elkehinze elkehinze is online now
The Queen of Typos
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2004
Location: Two Rivers, WI
Posts: 1,140 elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level)elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level)elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level)elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level)elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level)elkehinze User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 12 h 19 m 56 sec
Reputation Power: 46
Send a message via ICQ to elkehinze Send a message via AIM to elkehinze Send a message via MSN to elkehinze Send a message via Yahoo to elkehinze
Forgive me, if I sound like I'm being thick, I'm not trying to be (just apologizing in advance in case I come off that way).

Thanks for the input, I didn't close the sub or throw a check when the rs is at EOF because I was just modifying the original code to work with mine. I've only really gotten as far s formulating the queries.

I understand that what's going on is that it's stuck in the resursive loop so it overflows the memory. Will adding the exit help with that? I'm really a big asp noob and not much of a vb person. I understand it, but am still learning quite a bit about it.

Can you help push me in more of the right direction?

Thanks!

Reply With Quote
  #4  
Old April 16th, 2008, 12:47 AM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,713 Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level)Doug G User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 4 Weeks 1 Day 23 h 57 m 59 sec
Reputation Power: 688
The vbscript reference is here http://msdn2.microsoft.com/en-us/library/d1wf56tt.aspx

If you know your code is in an endless recursive loop, you'll have to determine how you want your code to operate and make adjustments accordingly. Look over your code line by line. If you have more specific questions post the details.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Stumped Getting Out of Memory Error


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway