943,929 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 6776
  • ASP RSS
Sep 17th, 2006
0

Why this error???Operation is not allowed when the object is closed.

Expand Post »
i m doing a simple timetable in timetable.asp with the following codes ,i created three links to view different levels of timetable. we got level 1 ,2 and 3. as this VIEW BY LEVEL 1 2 3

:mrgreen: so i pass the string 1 ,2 and 3.
<%
if request.QueryString("lowchar")="1" then

rs2.Open "select time_id,day,time,subject from timetable where course_code = 'H-170-1'" , conn ,1,2

else

if request.QueryString("lowchar")="2" then rs2.Open "select time_id,day,time,subject from timetable where course_code = 'H-170-2'" , conn ,1,2

else

if request.QueryString("lowchar")="3" then rs2.Open "select time_id,day,time,subject from timetable where course_code = 'H-170-3'" , conn ,1,2

end if
end if
end if

rno=0
while not rs2.EOF // this line show the above error
rno=rno+1
if rno mod 2=0 then
bgcolor="#ffffcc"
else
bgcolor="#ffff99"
end if

%>

Operation is not allowed when the object is closed. Do i need to define a new object? or maybe open a object? if so where n how? thank you dani webbies and especially chmonalisa, u r wonderful person.
Similar Threads
Reputation Points: 12
Solved Threads: 1
Newbie Poster
Qcdms21 is offline Offline
17 posts
since Jun 2006
Sep 25th, 2006
0

Re: Why this error???Operation is not allowed when the object is closed.

You figured it out yet?
The error tells you that RS2 is not open...that mean none of your evaulations return true.
Either rewrite your code to include an "else" the no nested conditional action, or check if RS2 is open before "rs2.eof". You can do this by "rs2.state"
Reputation Points: 10
Solved Threads: 5
Junior Poster
madmital is offline Offline
119 posts
since Jun 2005
Sep 27th, 2006
0

Re: Why this error???Operation is not allowed when the object is closed.

Yes , i figured it out.

this is the way

if rs2.State <> 1 then

rs2.Open"select time_id,day,time,subject,course_code,lecturer,venue from timetable where course_code like '" & id & "%'", conn,2,1

end if

while not rs2.EOF
Reputation Points: 12
Solved Threads: 1
Newbie Poster
Qcdms21 is offline Offline
17 posts
since Jun 2006
Oct 12th, 2006
0

Re: Why this error???Operation is not allowed when the object is closed.

The best way of finding an answer to an asp program is to copy the error code and paste it in google.com then perform a search, you will defenately come to know the solution of your problem.
Reputation Points: 58
Solved Threads: 1
Posting Whiz in Training
cancer10 is offline Offline
234 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: SQL query problem with WHERE clause
Next Thread in ASP Forum Timeline: Import excel records into ASP database





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC