|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
||||
|
||||
|
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:
|
|
#2
|
|||
|
|||
|
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 |
|
#3
|
||||
|
||||
|
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! |
|
#4
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Stumped Getting Out of Memory Error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|