BigRed1212
Technical User
Hi,
I have an application that writes out records in a recordset that meet a criterion; specifically for each soccer game in recordset1 (rs) it writes out the ident of the goal scorers from recordset2 (rs2) for that game.
The control structure I have is:
...[Do while not rs.Eof followed by some response.writes for the game information]...
Do while not rs2.Eof
if rs2("lineid") = no then
response.write rs2("ident") & ", "
End If
rs2.movenext
Loop
...[Loop back the outer loop and close everything up when done]...
where no is a counter. This works great except that it has a trailing comma. If I have 4 values for ident that need to be written they will write out as
2, 3, 4, 6,
I think
2, 3, 4, 6
would look nicer.
I tried to peek ahead in rs2 to see whether I need the comma using:
Do while not rs2.Eof
If rs2("lineid") = no then
response.write rs2("ident")
rs2.movenext
If rs2("lineid") = no then
response.write ", "
End If
rs2.moveprevious
End If
rs2.movenext
Loop
but it throws an error on the moveprevious saying it isn't allowed there.
Got an idea for a better control structure that I can use to ditch the final comma?
TIA.
I have an application that writes out records in a recordset that meet a criterion; specifically for each soccer game in recordset1 (rs) it writes out the ident of the goal scorers from recordset2 (rs2) for that game.
The control structure I have is:
...[Do while not rs.Eof followed by some response.writes for the game information]...
Do while not rs2.Eof
if rs2("lineid") = no then
response.write rs2("ident") & ", "
End If
rs2.movenext
Loop
...[Loop back the outer loop and close everything up when done]...
where no is a counter. This works great except that it has a trailing comma. If I have 4 values for ident that need to be written they will write out as
2, 3, 4, 6,
I think
2, 3, 4, 6
would look nicer.
I tried to peek ahead in rs2 to see whether I need the comma using:
Do while not rs2.Eof
If rs2("lineid") = no then
response.write rs2("ident")
rs2.movenext
If rs2("lineid") = no then
response.write ", "
End If
rs2.moveprevious
End If
rs2.movenext
Loop
but it throws an error on the moveprevious saying it isn't allowed there.
Got an idea for a better control structure that I can use to ditch the final comma?
TIA.