Forums
This topic is locked
ADODB.Recordset error '800a0bcd'
Posted 28 Nov 2007 14:41:36
1
has voted
28 Nov 2007 14:41:36 Colm Gavin posted:
Hi All,I was wondering if you could help me with an issue I am having.
I have a web page that performs an SQL SELECT and returns 11 rows. These values are being output 8 rows per page. It is working fine under every circumstance (as far as I can see) except when I search for %RYAN%.
It displays the first 8 rows fine but when I click to move to the next page I get the following error:
<i>ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/visitorarrival.asp, line 159</i>
I have researched this and see that this error is because the record set tries to move onto a blank row. I have put in error handling code to stop the dump but my question is why this error is appearing at all.
I have searched for %AN% and it returned the results across multiple pages and everything was fine. It is just this specific search term %RYAN% that is causing the issue.
I would greatly appreciate it if someone could tell me why this is happening and what I can do to solve it.
Many thanks,
Colm
<pre id=code><font face=courier size=2 id=code>
<%@ LANGUAGE="VBSCRIPT" %>
<!-- #INCLUDE FILE="pig.asp" -->
<html>
<script language="Javascript" src="getoptions.js"></script>
<%
set acom = server.CreateObject("Onsite.on_st_sites"
DBDate = acom.get_the_dbdate()
set acom = Nothing
if len(Request.Form("visitorarrival_srch") = 0 then
if len(Request.Form("sId") <> 0 then
if (Request.Form("visitorarrivalupd" = "visitorarrivalupd" then
'**************************
' Updating a Record
'**************************
id = Request.Form("sId"
rg = Request.Form("vreg"
st = "I"
set acom = server.CreateObject("Onsite.on_st_sites"
comStat = acom.visits_stat_upd(id, rg, st)
set acom = Nothing
' Where there any errors
if comStat <> "0" then
displayerror(comStat)
end if
visitorarrival_lst_OnSubmit = False
nosel = "1"
end if
end if
end if
%>
<head>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<title></title>
</head>
<body background="images/onsite_bck.gif" text="#000000" vlink="#000000" alink="#000000" link="#000000">
<%heading = "Visitor Arrival Management Page"%>
<table width="669" height="143">
<th width="131" align="left" height="16"><b><img src="images/images/Corporate2.gif" width="133" height="67" align="right"><br>
<br>
</b></th>
<th width="524" BGCOLOR="000000" height="1"><font size="3" color="ffffff">
<%if(isempty(Request.querystring("heading")) then
Response.write(heading)
else
Response.Write(Request.QueryString("heading")
end if
if(isempty(Request.querystring("srt")) then
sor="N"
else
sor=Request.querystring("srt"
end if
%>
</font></th>
<tr><td width="131" valign="top" nowrap height="153">
<!-- #INCLUDE FILE="ONSITE_ACCESS.asp" -->
<!-- #INCLUDE FILE="ONSITE_DD.asp" -->
</td>
<td width="524" height="118" rowspan="2">
<%
if (Request.QueryString("visitorarrival_lst" = "yes" then%>
<form name="visitorarrival_lst" ACTION="visitorarrival.asp?visitorarrival_lst=yes&srt=<%=sor%>" METHOD="POST">
<input type="hidden" name="allowsearch" value ="allow">
<input type="hidden" name="vreg">
<input type="hidden" name="sId">
<input type="hidden" name="visitorarrivalupd" value="visitorarrivalupd">
<hr>
<table width="100%">
<tr BGCOLOR="CE6129">
<td colspan="2"> <font size="2" color="ffffff">Search for a Visitor</font></tr>
</tr>
<tr>
<td>Visitor Name</td>
<td>
<td><input type="text" name="visitorarrival_srch" size="32" value="<%=selectvalue%>"></td>
</tr>
<tr>
<td>Company Name</td>
<td>
<td><input type="text" name="company" size="32" value="<%=selectvalue2%>"></td>
<%
if(isempty(Request.Form("visitorarrival_srch") and Request.QueryString("next" <> "yes" then
selectvalue = "All"
elseif (Request.QueryString("next" = "yes" then
selectvalue = request.querystring("mainheading"
selectvalue2 = request.querystring("mainheading2"
else
selectvalue = request.form("visitorarrival_srch"
selectvalue2 = request.form("company"
end if
if nosel = 1 then
selectvalue = "All"
nosel = "0"
end if
%>
<td><input type="image" src="images/search.gif" border="0" id="image1" name="image1" WIDTH="97" HEIGHT="27"></td>
</tr>
</table>
<hr>
<%
set rs = Nothing
set acom = server.CreateObject("Onsite.on_st_sites"
set rs = acom.sites_lst_user()
sSite = rs(0)
rs.Close
'if(isempty(Request.form("visitorarrival_srch"))then
' if(isempty(Request.querystring("mainheading")) then
if(isempty(selectvalue)) then
set acom = server.CreateObject("Onsite.on_st_sites"
set rs = acom.visits_expected_lst(sSite, "A", sor)
set acom = Nothing
elseif(selectvalue = "All" then
set acom = server.CreateObject("Onsite.on_st_sites"
set rs = acom.visits_expected_lst(sSite, "A", sor)
set acom = Nothing
else
seablank = ""
seavalue = "UPPER('" & selectvalue & "%')"
seavalue2 = "UPPER('" & selectvalue2 & "%')"
script = "SELECT ON_ST_VISITS.SITE_SITE, ON_ST_VISITS.NAME, ON_ST_VISITS.ID, ON_ST_VISITS.PER_ID, ON_ST_COMPANIES.NAME AS Expr1, ON_ST_VISITS.APPROVAL_STATUS, ON_ST_VISITS.EXPECTED_DATE FROM ON_ST_VISITS INNER JOIN ON_ST_PEOPLE ON ON_ST_VISITS.PER_ID = ON_ST_PEOPLE.ID INNER JOIN ON_ST_COMPANIES ON ON_ST_PEOPLE.COM_ID = ON_ST_COMPANIES.ID WHERE ON_ST_VISITS.APPROVAL_STATUS = 'A' AND ON_ST_VISITS.EXPECTED_DATE = TRUNC(SYSDATE)"
if len(seavalue) > 2 then
script = script & " AND ON_ST_VISITS.SITE_SITE = '" & sSite & "'"
end if
if len(seavalue) > 2 then
script = script & " AND UPPER(ON_ST_VISITS.NAME) LIKE " & seavalue
end if
if len(seavalue2) > 2 then
script = script & " AND UPPER(ON_ST_COMPANIES.NAME) LIKE " & seavalue2
end if
set acom = server.CreateObject("Onsite.on_st_sites"
set rs = acom.areas_lke(script, seablank)
set acom = Nothing
end if
if(rs.RecordCount = 0) then%>
<h3><i> No records found </i></h3>
<%
Response.end
end if
%>
<table cellpadding="2" cellspacing="0" border="0">
<th bgcolor="CE6129"></th>
<th bgcolor="CE6129"><font face="verdana,helvetica,arial" size="2" color="ffffff"><a href="visitorarrival.asp?visitorarrival_lst=yes&srt=N">Name</a></font></th>
<th bgcolor="CE6129"><font face="verdana,helvetica,arial" size="2" color="ffffff"> </font></th>
<th bgcolor="CE6129"><font face="verdana,helvetica,arial" size="2" color="ffffff"><a href="visitorarrival.asp?visitorarrival_lst=yes&srt=C">Company</a></font></th>
<th bgcolor="CE6129"><font face="verdana,helvetica,arial" size="2" color="ffffff">Expected Date</font></th>
<th bgcolor="CE6129"><font face="verdana,helvetica,arial" size="2" color="ffffff"> </font></th>
<%
if(isempty(Request.QueryString("myrecordcount")) then
myrecordcount = 0
else
myrecordcount = Request.QueryString("myrecordcount"
if not rs.eof then
rs.movefirst
rs.Move myrecordcount
else
response.write "End of Records"
Response.Write ("<br>"
Response.Write ("<br>"
response.write "If the record you are looking for has not been found. Please narrow your search terms."
Response.Write ("<br>"
Response.Write ("<br>"
response.write "For example if you are searching for Maurice Ryan"
Response.Write ("<br>"
Response.Write ("<br>"
response.write "Please enter M%RYAN% in search box above"
end if
end if
mycount = 0
if Not rs.EOF and not rs.BOF then
Do
if not rs.eof then %>
<tr>
<td BGCOLOR="FFCC99" height="1"><img height="13" src="images/bulletpoint.gif" width="14"></td>
<td BGCOLOR="FFCC99" height="1"><font color="#000000" face="verdana,helvetica,arial" size="2"><%=rs(1)%></font></td>
<td BGCOLOR="FFCC99" height="1"><font color="#000000" face="verdana,helvetica,arial" size="2"><input type="image" src="images/Admit.gif" border="0" id="image1" name="image1" WIDTH="97" HEIGHT="27" onClick="CheckReg('visitorarrival_lst','<%=rs(2)%>')"></td>
<td BGCOLOR="FFCC99" height="1"><font color="#000000" face="verdana,helvetica,arial" size="2"><%=rs(4)%></font></td>
<td BGCOLOR="FFCC99" height="1"><font color="#000000" face="verdana,helvetica,arial" size="2"><%=rs(6)%></font></td>
<td BGCOLOR="FFCC99" height="1"><font color="#000000" face="verdana,helvetica,arial" size="2"><a href="javascript<img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>oplabel('<%=rs(2)%>','visitorarrival_lst')"><B>Print Label</B></a></font></td>
</tr>
<%mycount = mycount + 1
if mycount = 8 then
previous_page = 0
page_count = myrecordcount + mycount
if page_count > 8 then
previous_page = page_count - 16
if previous_page < 0 then
previous_page = 0
end if
end if%>
</table>
<%if not rs.eof then%><a href="visitorarrival.asp?next=yes&mainheading=<%=selectvalue%>&mainheading2=<%=selectvalue2%>&visitorarrival_lst=yes&srt=<%=sor%>&heading=Visitor+Arrival+Management+Page&myrecordcount=<%=page_count%>">Next</a> <%end if%>
<%if page_count > 8 then %><a href="visitorarrival.asp?next=yes&mainheading=<%=selectvalue%>&mainheading2=<%=selectvalue2%>&visitorarrival_lst=yes&srt=<%=sor%>&heading=Visitor+Arrival+Management+Page&myrecordcount=0">First</a> <%end if%>
<%if page_count > 8 then %><a href="visitorarrival.asp?next=yes&mainheading=<%=selectvalue%>&mainheading2=<%=selectvalue2%>&visitorarrival_lst=yes&srt=<%=sor%>&heading=Visitor+Arrival+Management+Page&myrecordcount=<%=previous_page%>">Previous</a> <% end if %>
<% Response.end
end if
rs.movenext
end if
Loop until rs.eof
if rs.eof then
page_count = myrecordcount
previous_page = 0
if page_count > 8 then
previous_page = page_count - 8
if previous_page < 0 then
previous_page = 0
end if
end if%>
</table>
<%if page_count > 0 then%>
<a href="visitorarrival.asp?next=yes&mainheading=<%=selectvalue%>&mainheading2=<%=selectvalue2%>&visitorarrival_lst=yes&srt=<%=sor%>&heading=Visitor+Arrival+Management+Page&myrecordcount=0">First</a>
<a href="visitorarrival.asp?next=yes&mainheading=<%=selectvalue%>&mainheading2=<%=selectvalue2%>&visitorarrival_lst=yes&srt=<%=sor%>&heading=Area+Code+Management+Page&myrecordcount=<%=previous_page%>">Previous</a>
<%end if
end if
end if
end if%>
<%function displayerror(errortext)%>
</td></tr>
</table>
<table>
<tr><td rowspan="2"><img SRC="images/erroricon.gif" ALT="You got an error" WIDTH="96" HEIGHT="192"></td><td><b><%=errortext%></b></td><td width="25%"></td></tr>
</table>
<%Response.end%>
<%end function%>
<script LANGUAGE="vbscript">
function visitorarrival_lst_OnSubmit
Dim frm1
Dim strRes
set frm1 = Document.visitorarrival_lst
strRes = frm1.allowsearch.value
visitorarrival_lst_OnSubmit = True
end function
</script>
</body>
</form>
</font id=code></pre id=code>