I have an asp page that displays a list of records according to what im pulling in from my select statement. As long as there is a record in the database the page works fine but if all records in the database are deleted then the page crashes.
I've used the same code in other pages and have no problem with it but for some reason this page either hits EOF or BOF and the page just doesn't load. I've tried a bunch of different "If" statements and different combinations of the EOF or BOF statements to try and stop it from hitting end of file but it still does.
Is there an easy way to stop this from happening using my code below?
Expand|Select|Wrap|Line Numbers
- set rs = server.createobject("adodb.recordset")
- dim location
- location = Session("location")
- strSQL = "SELECT * " _
- & "FROM db_accessadmin.callbacks " _
- & "WHERE location ='"& location &"' AND "_
- & "status ='Open' OR " _
- & "status ='WIP' " _
- & "ORDER BY ID desc;"
- rs.Open strSQL, oConn, adOpenStatic
- Dim intcount1
- intcount1 = 0
- If Not rs.EOF Then
- rs.MoveFirst
- Do while Not rs.EOF
- StartTime = rs("date")
- diff1 = (DateDiff("h",StartTime,EndTime))
- intcount1 = intcount1 + 1
- dim count1
- count1 = intcount1
- response.write "<tr><td><font face='Arial' color='#111111' size='2'>" & rs("admin") & "</td></font>"
- response.write "<td><font face='Arial' size='2'>" & rs("ticket") & "</td></font>"
- response.write "<td><font face='Arial' size='2'>" & rs("helpdesk") & "</td></font>"
- response.write "<td><font face='Arial' size='2'>" & rs("division") & "</td></font>"
- response.write "<td><center><font face='Arial' size='2'>" & diff1 & "</td></font></center>"
- response.write "<td><font size='2' face='Arial'><i><b><a href='ADMINUpdateCallback.asp?FID=" & rs("ID") & "&queue=" & diff1 & "'>" & rs("status") & "</a></b></i></font></td></tr>"
- rs.moveNext
- loop
- End If
- response.write "<font face='Arial' color='#344C7C' size='1'><b>All Other Callbacks = " & count1 & "</b></font>"
- rs.close
- set rs=nothing
- oConn.close
- set oConn=nothing