Consider a recordset containing four rows, as below
Team NumDocs
OPS10 2
OPS4 1
OPS5 2
OPS7 3
Consider also the following row in a table to display these.
<td>
<% If Trim(RS("Team")) = "OPS1" And not RS.EOF Then
Response.Write(RS("NumDocs"))
RS.MoveNext
End If%>
</td>
<td>
<% If Trim(RS("Team")) = "OPS10" And not RS.EOF Then
Response.Write(RS("NumDocs"))
RS.MoveNext
End If%>
</td>
<td>
<% If Trim(RS("Team")) = "OPS2" And not RS.EOF Then
Response.Write(RS("NumDocs"))
RS.MoveNext
End If%>
</td>
<td>
<% If Trim(RS("Team")) = "OPS3" And not RS.EOF Then
Response.Write(RS("NumDocs"))
RS.MoveNext
End If%>
</td>
<td>
<% If Trim(RS("Team")) = "OPS4" And not RS.EOF Then
Response.Write(RS("NumDocs"))
RS.MoveNext
End If%>
</td>
<td>
<% If Trim(RS("Team")) = "OPS5" And not RS.EOF Then
Response.Write(RS("NumDocs"))
RS.MoveNext
End If%>
</td>
<td>
<% If Trim(RS("Team")) = "OPS6" And not RS.EOF Then
Response.Write(RS("NumDocs"))
RS.MoveNext
End If%>
</td>
<td>
<% If Trim(RS("Team")) = "OPS7" And not RS.EOF Then
Response.Write(RS("NumDocs"))
RS.MoveNext
End If%>
</td>
<td>
<% If Trim(RS("Team")) = "OPS8" And Not RS.EOF Then
Response.Write(RS("NumDocs"))
RS.MoveNext
End If%>
</td>
<td>
<% If Trim(RS("Team")) = "OPS9" And Not RS.EOF Then
Response.Write(RS("NumDocs"))
RS.MoveNext
End If%>
</td>
The header row contains 10 hard coded headings, OPS1, OPS10, OPS2, etc.
The section above which populates OPS7’s colum is fine, and the value of “2” is written to the cell. Then I get an error on the next column for OPS8 – obviously there’s no returned value for this as it only goes up to OPS7. This is why I put a Not EOF in the IF statement, but I am still getting the error.
Can anyone assist?
You should move the RS.EOF to the first check in the IF statement E.G., go from this
to this
The problem is that
Andis not a short circuit operation in classic asp.