I have the following code which pulls links from a database and displays them with month and day descending...grouped by month. The output looks something like this
December
2003-12-11
some link here
2003-12-05
some link here
November
.....etc
The code is working but breaks once the last record is reached...this is when I get the error code...
error '80020009'
Exception occurred.
the error refers to this particular line of code
Do while objChronoRS("month") = lTempMonth
Anyways here is the code...
objConn.Open
DIM myChrono
Set objChronoRS= Server.CreateObject("ADODB
.Recordset
")
myChrono = "SELECT * From mediaroom WHERE year="+vYear+" AND class='" & vClass & "' order by month DESC,day DESC"
objChronoRS.Open myChrono, objConn, 1, 3
Dim lTempMonth
lTempMonth = 0
Do while not objChronoRS.eof
lTempMonth = objChronoRS("month")
if objChronoRS("month")= 12 then
response.write("<h2>")
response.write("December")
response.write("</h2>")
elseif objChronoRS("month")= 11 then
response.write("<h2>")
response.write("November")
response.write("</h2>")
elseif objChronoRS("month")= 10 then
response.write("<h2>")
response.write("October")
response.write("</h2>")
elseif objChronoRS("month")= 9 then
response.write("<h2>")
response.write("September"
)
response.write("</h2>")
elseif objChronoRS("month")= 8 then
response.write("<h2>")
response.write("August")
response.write("</h2>")
elseif objChronoRS("month")= 7 then
response.write("<h2>")
response.write("July")
response.write("</h2>")
elseif objChronoRS("month")= 6 then
response.write("<h2>")
response.write("June")
response.write("</h2>")
elseif objChronoRS("month")= 5 then
response.write("<h2>")
response.write("May")
response.write("</h2>")
elseif objChronoRS("month")= 4 then
response.write("<h2>")
response.write("April")
response.write("</h2>")
elseif objChronoRS("month")= 3 then
response.write("<h2>")
response.write("March")
response.write("</h2>")
elseif objChronoRS("month")= 2 then
response.write("<h2>")
response.write("February")
response.write("</h2>")
elseif objChronoRS("month")= 1 then
response.write("<h2>")
response.write("January")
response.write("</h2>")
end if
Do while objChronoRS("month") = lTempMonth
'print other details for that month here
vMonth=objChronoRS("month"
)
vYear=objChronoRS("year")
link=objChronoRS("link")
vDay=objChronoRS("day")
response.write("<p>")
response.write(vYear)
response.write("-")
if vMonth < 10 then
response.write("0")
response.write(vMonth)
else
response.write(vMonth)
end if
response.write("-")
if vDay < 10 then
response.write("0")
response.write(vDay)
else
response.write(vDay)
end if
response.write("<br>")
response.write(link)
response.write("<br>")
objChronoRS.movenext()
Loop
Loop
objChronoRS.Close
Set objChronoRS = Nothing
objConn.Close
end if
thanks groovymonkey
Start Free Trial