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:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old April 29th, 2008, 11:07 AM
elkehinze's Avatar
elkehinze elkehinze is offline
The Queen of Typos
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Sep 2004
Location: Two Rivers, WI
Posts: 1,146 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 13 h 35 m 36 sec
Reputation Power: 49
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
Object Required Error - Need a little Push

Never mind, was able to figure it out.

The problem was that I had my strSQL2 and objRS2 variables declared on a global level, once I put them in the sub it works like a charm.


=======================

Hi guys,

little bit of background on this project. I'm using the script located here
to generate some menus.

My version can be seen here

I have now moved it to the server at work, and am modifying the script to work with some libraries we have set up here. We use a disconnected recordset function to grab our queries, and this is where I'm running into the problem.

I am getting an "object required" error when I call the Sub again a second time. My guess is that the rs is not being reopened again but I'm not sure why. I have put the text in bold where it's failing.

some of the original code is still in there, I've left it for now, but it's commented out. I don't need it because my disconnected recordset function should be doing all of it.

Code:
Sub listSubCat(MenuID)
	
	strSQL2 = "SELECT menuCat.MenuID, menuCat.MenuName, menuCat.isParent, menuCat.MenuLink FROM menuCat" &_
		  " INNER JOIN menuSubCat ON menuCat.MenuID = menuSubCat.MenuID" &_
		  " WHERE menuSubCat.SubMenuID = " & MenuID &_
		  " ORDER BY menuCat.SortOrder"

   	set objRS2 = GetDisconnectedRecordset(strSQL2, "GetChildMenus", false)	  

	'Set SubCat = Server.CreateObject("ADODB.Recordset")
	'SubCat.ActiveConnection = MM_MenuSystem_STRING
	'SubCat.Source = sql
	'SubCat.CursorType = 0
	'SubCat.CursorLocation = 2
	'SubCat.LockType = 1
	'objRS2.Open()
		
	If Not objRS2.EOF Or Not objRS2.BOF Then
	Response.Write "<ul class=""second_lvl"">" & vbCRLF
		While NOT objRS2.EOF
			
			'Indented Response.Write indicates optional output
			Response.Write "<li "
			if (objRS2("isParent") = "True") then
			  response.write "class=""next_arrow"" "
			end if
			Response.write ">"
			if (objRS2("MenuLink") <> "") then
			    Response.Write "<a href="""&objRS2("MenuLink")&""">" &objRS2("MenuName")&"</a>"
			else
			    Response.Write "<a href=""#"">" &objRS2("MenuName")&"</a>"
			end if
			
			Response.Write vbCRLF

			
			Call listSubCat(objRS2("MenuID"))
			
			Response.Write  "</li>" & vbCRLF
		
'Code fails here
		objRS2.MoveNext()
		Wend
	   Response.Write  "</ul>" & vbCRLF
	
	End If 
	objRS2.Close()
	Set objRS2 = Nothing
	
End Sub


If I comment out objRS2.Close() and set objRS2 = Nothing, then I get the following error on the same line as above.

Quote:
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
__________________

Last edited by elkehinze : April 29th, 2008 at 01:43 PM. Reason: Solved

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Object Required Error - Need a little Push


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 5 hosted by Hostway