Forums

ASP

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>
&lt;%@ LANGUAGE="VBSCRIPT" %&gt;
&lt;!-- #INCLUDE FILE="pig.asp" --&gt;
&lt;html&gt;
&lt;script language="Javascript" src="getoptions.js"&gt;&lt;/script&gt;
&lt;%
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") &lt;&gt; 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 &lt;&gt; "0" then
displayerror(comStat)
end if
visitorarrival_lst_OnSubmit = False
nosel = "1"
end if
end if
end if
%&gt;

&lt;head&gt;
&lt;meta NAME="GENERATOR" Content="Microsoft FrontPage 4.0"&gt;
&lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body background="images/onsite_bck.gif" text="#000000" vlink="#000000" alink="#000000" link="#000000"&gt;
&lt;%heading = "Visitor Arrival Management Page"%&gt;
&lt;table width="669" height="143"&gt;
&lt;th width="131" align="left" height="16"&gt;&lt;b&gt;&lt;img src="images/images/Corporate2.gif" width="133" height="67" align="right"&gt;&lt;br&gt;
&lt;br&gt;
&lt;/b&gt;&lt;/th&gt;
&lt;th width="524" BGCOLOR="000000" height="1"&gt;&lt;font size="3" color="ffffff"&gt;
&lt;%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
%&gt;
&lt;/font&gt;&lt;/th&gt;
&lt;tr&gt;&lt;td width="131" valign="top" nowrap height="153"&gt;
&lt;!-- #INCLUDE FILE="ONSITE_ACCESS.asp" --&gt;
&lt;!-- #INCLUDE FILE="ONSITE_DD.asp" --&gt;
&lt;/td&gt;
&lt;td width="524" height="118" rowspan="2"&gt;
&lt;%
if (Request.QueryString("visitorarrival_lst" = "yes" then%&gt;
&lt;form name="visitorarrival_lst" ACTION="visitorarrival.asp?visitorarrival_lst=yes&amp;srt=&lt;%=sor%&gt;" METHOD="POST"&gt;
&lt;input type="hidden" name="allowsearch" value ="allow"&gt;
&lt;input type="hidden" name="vreg"&gt;
&lt;input type="hidden" name="sId"&gt;
&lt;input type="hidden" name="visitorarrivalupd" value="visitorarrivalupd"&gt;
&lt;hr&gt;
&lt;table width="100%"&gt;
&lt;tr BGCOLOR="CE6129"&gt;
&lt;td colspan="2"&gt; &lt;font size="2" color="ffffff"&gt;Search for a Visitor&lt;/font&gt;&lt;/tr&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Visitor Name&lt;/td&gt;
&lt;td&gt;
&lt;td&gt;&lt;input type="text" name="visitorarrival_srch" size="32" value="&lt;%=selectvalue%&gt;"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Company Name&lt;/td&gt;
&lt;td&gt;
&lt;td&gt;&lt;input type="text" name="company" size="32" value="&lt;%=selectvalue2%&gt;"&gt;&lt;/td&gt;
&lt;%
if(isempty(Request.Form("visitorarrival_srch") and Request.QueryString("next" &lt;&gt; "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
%&gt;
&lt;td&gt;&lt;input type="image" src="images/search.gif" border="0" id="image1" name="image1" WIDTH="97" HEIGHT="27"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;%
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) &gt; 2 then
script = script & " AND ON_ST_VISITS.SITE_SITE = '" & sSite & "'"
end if
if len(seavalue) &gt; 2 then
script = script & " AND UPPER(ON_ST_VISITS.NAME) LIKE " & seavalue
end if
if len(seavalue2) &gt; 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%&gt;
&lt;h3&gt;&lt;i&gt; No records found &lt;/i&gt;&lt;/h3&gt;
&lt;%
Response.end
end if
%&gt;
&lt;table cellpadding="2" cellspacing="0" border="0"&gt;
&lt;th bgcolor="CE6129"&gt;&lt;/th&gt;
&lt;th bgcolor="CE6129"&gt;&lt;font face="verdana,helvetica,arial" size="2" color="ffffff"&gt;&lt;a href="visitorarrival.asp?visitorarrival_lst=yes&amp;srt=N"&gt;Name&lt;/a&gt;&lt;/font&gt;&lt;/th&gt;
&lt;th bgcolor="CE6129"&gt;&lt;font face="verdana,helvetica,arial" size="2" color="ffffff"&gt; &lt;/font&gt;&lt;/th&gt;
&lt;th bgcolor="CE6129"&gt;&lt;font face="verdana,helvetica,arial" size="2" color="ffffff"&gt;&lt;a href="visitorarrival.asp?visitorarrival_lst=yes&amp;srt=C"&gt;Company&lt;/a&gt;&lt;/font&gt;&lt;/th&gt;
&lt;th bgcolor="CE6129"&gt;&lt;font face="verdana,helvetica,arial" size="2" color="ffffff"&gt;Expected Date&lt;/font&gt;&lt;/th&gt;
&lt;th bgcolor="CE6129"&gt;&lt;font face="verdana,helvetica,arial" size="2" color="ffffff"&gt; &lt;/font&gt;&lt;/th&gt;
&lt;%
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 ("&lt;br&gt;"
Response.Write ("&lt;br&gt;"
response.write "If the record you are looking for has not been found. Please narrow your search terms."
Response.Write ("&lt;br&gt;"
Response.Write ("&lt;br&gt;"
response.write "For example if you are searching for Maurice Ryan"
Response.Write ("&lt;br&gt;"
Response.Write ("&lt;br&gt;"
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 %&gt;
&lt;tr&gt;
&lt;td BGCOLOR="FFCC99" height="1"&gt;&lt;img height="13" src="images/bulletpoint.gif" width="14"&gt;&lt;/td&gt;
&lt;td BGCOLOR="FFCC99" height="1"&gt;&lt;font color="#000000" face="verdana,helvetica,arial" size="2"&gt;&lt;%=rs(1)%&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td BGCOLOR="FFCC99" height="1"&gt;&lt;font color="#000000" face="verdana,helvetica,arial" size="2"&gt;&lt;input type="image" src="images/Admit.gif" border="0" id="image1" name="image1" WIDTH="97" HEIGHT="27" onClick="CheckReg('visitorarrival_lst','&lt;%=rs(2)%&gt;')"&gt;&lt;/td&gt;
&lt;td BGCOLOR="FFCC99" height="1"&gt;&lt;font color="#000000" face="verdana,helvetica,arial" size="2"&gt;&lt;%=rs(4)%&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td BGCOLOR="FFCC99" height="1"&gt;&lt;font color="#000000" face="verdana,helvetica,arial" size="2"&gt;&lt;%=rs(6)%&gt;&lt;/font&gt;&lt;/td&gt;
&lt;td BGCOLOR="FFCC99" height="1"&gt;&lt;font color="#000000" face="verdana,helvetica,arial" size="2"&gt;&lt;a href="javascript<img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>oplabel('&lt;%=rs(2)%&gt;','visitorarrival_lst')"&gt;&lt;B&gt;Print Label&lt;/B&gt;&lt;/a&gt;&lt;/font&gt;&lt;/td&gt;



&lt;/tr&gt;

&lt;%mycount = mycount + 1
if mycount = 8 then
previous_page = 0
page_count = myrecordcount + mycount
if page_count &gt; 8 then
previous_page = page_count - 16
if previous_page &lt; 0 then
previous_page = 0
end if
end if%&gt;
&lt;/table&gt;
&lt;%if not rs.eof then%&gt;&lt;a href="visitorarrival.asp?next=yes&amp;mainheading=&lt;%=selectvalue%&gt;&amp;mainheading2=&lt;%=selectvalue2%&gt;&amp;visitorarrival_lst=yes&amp;srt=&lt;%=sor%&gt;&amp;heading=Visitor+Arrival+Management+Page&amp;myrecordcount=&lt;%=page_count%&gt;"&gt;Next&lt;/a&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;%end if%&gt;
&lt;%if page_count &gt; 8 then %&gt;&lt;a href="visitorarrival.asp?next=yes&amp;mainheading=&lt;%=selectvalue%&gt;&amp;mainheading2=&lt;%=selectvalue2%&gt;&amp;visitorarrival_lst=yes&amp;srt=&lt;%=sor%&gt;&amp;heading=Visitor+Arrival+Management+Page&amp;myrecordcount=0"&gt;First&lt;/a&gt;&nbsp;&nbsp;&nbsp;&nbsp;&lt;%end if%&gt;
&lt;%if page_count &gt; 8 then %&gt;&lt;a href="visitorarrival.asp?next=yes&amp;mainheading=&lt;%=selectvalue%&gt;&amp;mainheading2=&lt;%=selectvalue2%&gt;&amp;visitorarrival_lst=yes&amp;srt=&lt;%=sor%&gt;&amp;heading=Visitor+Arrival+Management+Page&amp;myrecordcount=&lt;%=previous_page%&gt;"&gt;Previous&lt;/a&gt;&nbsp;&nbsp;&nbsp;&lt;% end if %&gt;
&lt;% 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 &gt; 8 then
previous_page = page_count - 8
if previous_page &lt; 0 then
previous_page = 0
end if
end if%&gt;
&lt;/table&gt;
&lt;%if page_count &gt; 0 then%&gt;
&lt;a href="visitorarrival.asp?next=yes&amp;mainheading=&lt;%=selectvalue%&gt;&amp;mainheading2=&lt;%=selectvalue2%&gt;&amp;visitorarrival_lst=yes&amp;srt=&lt;%=sor%&gt;&amp;heading=Visitor+Arrival+Management+Page&amp;myrecordcount=0"&gt;First&lt;/a&gt;&nbsp;&nbsp;
&lt;a href="visitorarrival.asp?next=yes&amp;mainheading=&lt;%=selectvalue%&gt;&amp;mainheading2=&lt;%=selectvalue2%&gt;&amp;visitorarrival_lst=yes&amp;srt=&lt;%=sor%&gt;&amp;heading=Area+Code+Management+Page&amp;myrecordcount=&lt;%=previous_page%&gt;"&gt;Previous&lt;/a&gt;&nbsp;&nbsp;&nbsp;
&lt;%end if
end if
end if
end if%&gt;

&lt;%function displayerror(errortext)%&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;table&gt;
&lt;tr&gt;&lt;td rowspan="2"&gt;&lt;img SRC="images/erroricon.gif" ALT="You got an error" WIDTH="96" HEIGHT="192"&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;&lt;%=errortext%&gt;&lt;/b&gt;&lt;/td&gt;&lt;td width="25%"&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;%Response.end%&gt;
&lt;%end function%&gt;
&lt;script LANGUAGE="vbscript"&gt;
function visitorarrival_lst_OnSubmit
Dim frm1
Dim strRes
set frm1 = Document.visitorarrival_lst
strRes = frm1.allowsearch.value
visitorarrival_lst_OnSubmit = True
end function
&lt;/script&gt;
&lt;/body&gt;
&lt;/form&gt;
</font id=code></pre id=code>

Reply to this topic