recordset not showing up on page loop
Hi,
I have a asp page calling a db and pulling recordsets out and writing them on the homepage randomly. The problem is that some of these recordsets are being deleted. The remaining ones have the ID fields that count 1, 2, 3, 4, 6, 9, 12, and so forth. New ones are also being added. Now the randomizer pulls these out by ID number so if it selects ID 5 then nothing shows on the homepage (because it was deleted), any suggestions on a work around to this issue? Thanks
=================
CODE
=================
<%
DBOpen()
' Get most recent fact sheet
Set rstemp = conntemp.execute("SELECT * FROM tbl_Client ORDER BY id DESC")
lowerbound = 1
upperbound = rstemp("id")
Randomize
intRandom = Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Set rstemp = conntemp.execute("SELECT * FROM tbl_Client WHERE id = " & intRandom)
If Not rstemp.EOF Then
rstemp.MoveFirst
x = 0
Do Until rstemp.EOF
If x >= 4 Then
Exit Do
End If
Response.Write "<img border=""0"" src=""../" & rstemp("ImagePath") & """ align=""left"" width=""84"">" & vbCrLf
Response.Write "" & Mid(TrimHTML(rstemp("Summary")),1,350) & "..." & vbCrLf
Response.Write "<a href=""clientpage.asp?Client=" & rstemp("id") & """>find out more</a>" & vbCrLf
x = x + 1
rstemp.MoveNext
Loop
End If
DBClose()
%>
=============
END of CODE
=============
|