Reputation: 15
I'm getting this error with my asp page when i try to run a SQL query:
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
The code is:
' -- connect to Database1.accdb database --
set conn1 = server.createobject("adodb.connection")
conn1.open "provider = microsoft.ace.oledb.12.0;data source = C:\Users\nam2611\Documents\My Web Sites\WebSite1\Database3.accdb"
' -- get product recordset --
set rs1 = server.createobject("ADODB.Recordset")
rs1.open "select * from product where P_code like 'ap'", conn1
x = "<table border = 1 width= 1000><tr><th>code<Th>product name<th>Type<th>Price</Tr>"
response.write x
' -- create the table entries for each student --
rs1.movefirst
while not rs1.eof
x = "<tr><td>" & rs1("P_code") & "<td>" & rs1("P_name") & "<td>" & rs1("P_description") & "<td>" & rs1("P_price") & "</tr>"
response.write x
rs1.movenext
wend
response.write "</table>"
' -- close the datbase --
rs1.close
conn1.close
set rs1 = nothing
Upvotes: 0
Views: 1943
Reputation: 452
If you call MoveFirst()
and the recordset is empty, it throws an error.
You should check for EOF
:
If Not rs1.EOF Then
rs1.movefirst
' your loop
' ...
End If
Upvotes: 2