Hi, I want to exit the FOR loop when the rs0.EOF is true, but I got an error message.
Here is the code
--------------------------------
...
do while not rs0.EOF
%>
<tr align=center>
<%for i=1 to 4
if isNull(rs0("studentid"
) then
bgcolor="white"
notinclass=true
else
bgcolor="#FF9966"
end if%>
<td width=25%><table border=1 bgcolor="<%=bgcolor%>" bordercolor="gray" width="100"><tr><td> </td></tr></table><br><%=rs0("sname"
%></td>
<% if rs0.EOF then
Exit For
else
rs0.movenext
end if
next%>
</tr>
<%
loop
...
--------------------------------------------
the error message is
Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/HS/app/Admin/ClassStudent.asp
It seems that something to do with rs0.moveNext. the way I found out was to move "rs0.movenext" out of the FOR loop (nothing else is changed) and then the code works, but it doesn't give me the results I want)
--------------------------------
do while not rs0.EOF
%>
<tr align=center>
<%for i=1 to 4
if isNull(rs0("studentid"
) then
bgcolor="white"
notinclass=true
else
bgcolor="#FF9966"
end if%>
<td width=25%><table border=1 bgcolor="<%=bgcolor%>" bordercolor="gray" width="100"><tr><td> </td></tr></table><br><%=rs0("sname"
%></td>
<% if rs0.EOF then
Exit For
else
end if
next%>
</tr>
<%
rs0.movenext
loop
--------------------------------------------
I wonder what I have done wrong...
thanks in advance
Brian
Here is the code
--------------------------------
...
do while not rs0.EOF
%>
<tr align=center>
<%for i=1 to 4
if isNull(rs0("studentid"
bgcolor="white"
notinclass=true
else
bgcolor="#FF9966"
end if%>
<td width=25%><table border=1 bgcolor="<%=bgcolor%>" bordercolor="gray" width="100"><tr><td> </td></tr></table><br><%=rs0("sname"
<% if rs0.EOF then
Exit For
else
rs0.movenext
end if
next%>
</tr>
<%
loop
...
--------------------------------------------
the error message is
Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/HS/app/Admin/ClassStudent.asp
It seems that something to do with rs0.moveNext. the way I found out was to move "rs0.movenext" out of the FOR loop (nothing else is changed) and then the code works, but it doesn't give me the results I want)
--------------------------------
do while not rs0.EOF
%>
<tr align=center>
<%for i=1 to 4
if isNull(rs0("studentid"
bgcolor="white"
notinclass=true
else
bgcolor="#FF9966"
end if%>
<td width=25%><table border=1 bgcolor="<%=bgcolor%>" bordercolor="gray" width="100"><tr><td> </td></tr></table><br><%=rs0("sname"
<% if rs0.EOF then
Exit For
else
end if
next%>
</tr>
<%
rs0.movenext
loop
--------------------------------------------
I wonder what I have done wrong...
thanks in advance
Brian