PDA

View Full Version : Either BOF or EOF is True..


hughesmi
07-22-2008, 11:34 PM
Hi all, can someone plase help me sort this out?

My error

ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
testpage.asp, line 21


And my code. Line 21 is in red

<%
'Dim strpID,strpName,strURL,strImageName,intCount

Set objConn =Server.CreateObject("ADODB.connection")
objConn.open = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("fpdb/vsproducts.mdb")
Set rsTopNumber=objConn.execute("select count(*) from products")
intCount = rsTopNumber(0)
rsTopNumber.close

Set rsTopNumber=Nothing
intDays = DatePart("y",Now)

intStart = intdays Mod intCount
intStart = intStart + 1


sqlSELsite = "SELECT * FROM products WHERE pID = '" & intStart & "'"
Set ObjRSSel = Server.CreateObject("ADODB.Recordset")
ObjRSSel.Open sqlSELsite,objConn

strpID = ObjRSSel(0)
strpName = ObjRSSel(1)
'strURL = ObjRSSel(2)
'strImageName = ObjRSSel(3)
%>

<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td>
<div align="center"><a href=''>
<img src="images/<%=strpName%>" border="0"
width = "65" height = "65"
alt=""></a></div>
</td>
</tr>
<tr>
<td>
<div align="center">
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<a href=''></a></font></div>
</td>
</tr>
</table>

<% ObjRSSel.close
Set ObjRSSel = Nothing
Set objConn = Nothing
%>

Basscyst
07-22-2008, 11:39 PM
You need to check to see if a record was found prior to accessing any values in the recordset.


If Not ObjRSSel.EOF Then
'It's safe to access the recordset
End If

brazenskies
07-23-2008, 02:00 PM
aye, the row doesnt exist. I'd suggest writing your sql to the screen to make sure it's doing exactly what you want.