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
timetable.asp?lowchar=1
timetable.asp?lowchar=2
timetable.asp?lowchar=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.

Edited 3 Years Ago by Dani: Formatting fixed

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"

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

Edited 3 Years Ago by Dani: Formatting fixed

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.

This article has been dead for over six months. Start a new discussion instead.