hevy
12-13-2006, 02:40 PM
I am encountering the following error if a user enters a story number that does not exist.
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/stories.asp, line 0
Here is my code.
<%
strid = Request.QueryString("id")
Set objRS = objConn.Execute("SELECT * from stories WHERE id = " & strid )
%>
<table width="93%" height="490" border="0" align="center" cellpadding="0" bgcolor="#FFFFFF">
<td width="25%" height="486" valign="top" bgcolor="#E7ECD9">
<table width="174" border="0" cellpadding="0" cellspacing="0" class="latestarr">
</table>
<div class="">More about... <%=objRS("pname")%></div>
<div class="latest">
<a id="showAll" href="javascript:" onclick="showHideAll(this)" onmouseover="status=this.innerHTML; return true" onmouseout="status=''">Show all</a></p>
<div id="question_<%=objRS("id")%>"><a href="#" id="lnk_<%=objRS("id")%>" onclick="showHide('<%=objRS("id")%>'); return false" onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="/arrows5.gif" width="17" height="17"></a> <%=objRS("quote")%> </div>
<div id="answer_<%=objRS("id")%>" class="answers"><%=objRS("information")%></p></div>
<div id="question1_<%=objRS("id")%>"><a href="#" id="lnk1_<%=objRS("id")%>" onclick="showHide1('<%=objRS("id")%>'); return false" onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="images1/arrows5.gif" width="17" height="17"></a> <%=objRS("activities_title")%> </div>
<div id="answer1_<%=objRS("id")%>" class="answers1"><%=objRS("activities")%></div>
<div id="question2_<%=objRS("id")%>"><a href="#" id="lnk2_<%=objRS("id")%>" onclick="showHide2('<%=objRS("id")%>'); return false" onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="http://images1/arrows5.gif" width="17" height="17"></a> <%=objRS("reflect_title")%> </div>
<div id="answer2_<%=objRS("id")%>" class="answers2"><%=objRS("reflect")%></div>
<div id="question3_<%=objRS("id")%>"><a href="#" id="lnk3_<%=objRS("id")%>" onclick="showHide3('<%=objRS("id")%>'); return false" onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="http:///arrows5.gif" width="17" height="17"></a> <%=objRS("tools_title")%> </div>
<div id="answer3_<%=objRS("id")%>" class="answers3"><%=objRS("tools")%></div><br>
</div>
</td><td width="60%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" valign="top">
<td height="80" valign="top"><div class="latestcontain1">Location: The Stories </div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%
Function RegExpReplace(Str, Pattern, Replacement)
Set objRegExp = New RegExp
objRegExp.Pattern = Pattern
objRegExp.Global = True
objRegExp.ignoreCase = true
RegExpReplace = objRegExp.Replace(Str, Replacement)
Set objRegExp = Nothing
End Function
dim arrWords
strid = Request.QueryString("id")
strSQLText = "SELECT * from stories WHERE id = " & strid
strSQLWords = "SELECT title from glossary "
set rsWords = server.createobject("ADODB.recordset")
rsWords.ActiveConnection = strConnection
rsWords.Source = strSQLWords
rsWords.Open()
arrWords = rsWords.getRows()
rsWords.Close()
' Build regular expression for linking'
strPattern = "\b("
for i = 0 to ubound(arrWords, 2)
strPattern = strPattern & arrWords(0, i)
if i < uBound(arrWords, 2) then
strPattern = strPattern & "|"
end if
next
strPattern = strPattern & ")\b"
set rsText = server.createobject("ADODB.recordset")
rsText.ActiveConnection = strConnection
rsText.Source = strSQLText
rsText.Open()
strText = rsText("title")
strintro = rsText("introduction")
rsText.Close()
if not objRS.eof then
do while not objRS.eof
varPath = "http://www.domain.com/pdf/" & objRS("STORY_IDENTIFIER") & ".pdf"
Response.Write "<TD>"
Response.Write "<div id=indexContent><span class=""header"">"
Response.Write RegExpReplace(strText, strPattern, "<a href=""http://www.domain.com</a>")
Response.Write"</span>"
Response.Write RegExpReplace(strintro, strPattern, "<a href=""http://www.domain.com</a>")
Response.Write objRS("RELEVENT")
Response.Write objRS("FULLTEXTLINK")
Response.Write "<span class=""header"">View or print the story</span>" & "<a href=""" & varPath & """ target=""_blank"">" & "<br><br>" & "PDF" & "</a>"
Response.Write "</TD>"
objRS.movenext
loop
else
response.write "No stories matched your search."
end if
objRS.Close
set objRS = Nothing
objConn.Close
set objConn = Nothing
%>
What is going wrong?
Cheers
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/stories.asp, line 0
Here is my code.
<%
strid = Request.QueryString("id")
Set objRS = objConn.Execute("SELECT * from stories WHERE id = " & strid )
%>
<table width="93%" height="490" border="0" align="center" cellpadding="0" bgcolor="#FFFFFF">
<td width="25%" height="486" valign="top" bgcolor="#E7ECD9">
<table width="174" border="0" cellpadding="0" cellspacing="0" class="latestarr">
</table>
<div class="">More about... <%=objRS("pname")%></div>
<div class="latest">
<a id="showAll" href="javascript:" onclick="showHideAll(this)" onmouseover="status=this.innerHTML; return true" onmouseout="status=''">Show all</a></p>
<div id="question_<%=objRS("id")%>"><a href="#" id="lnk_<%=objRS("id")%>" onclick="showHide('<%=objRS("id")%>'); return false" onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="/arrows5.gif" width="17" height="17"></a> <%=objRS("quote")%> </div>
<div id="answer_<%=objRS("id")%>" class="answers"><%=objRS("information")%></p></div>
<div id="question1_<%=objRS("id")%>"><a href="#" id="lnk1_<%=objRS("id")%>" onclick="showHide1('<%=objRS("id")%>'); return false" onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="images1/arrows5.gif" width="17" height="17"></a> <%=objRS("activities_title")%> </div>
<div id="answer1_<%=objRS("id")%>" class="answers1"><%=objRS("activities")%></div>
<div id="question2_<%=objRS("id")%>"><a href="#" id="lnk2_<%=objRS("id")%>" onclick="showHide2('<%=objRS("id")%>'); return false" onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="http://images1/arrows5.gif" width="17" height="17"></a> <%=objRS("reflect_title")%> </div>
<div id="answer2_<%=objRS("id")%>" class="answers2"><%=objRS("reflect")%></div>
<div id="question3_<%=objRS("id")%>"><a href="#" id="lnk3_<%=objRS("id")%>" onclick="showHide3('<%=objRS("id")%>'); return false" onmouseover="status=this.innerHTML; return true" onmouseout="status=''"><img src="http:///arrows5.gif" width="17" height="17"></a> <%=objRS("tools_title")%> </div>
<div id="answer3_<%=objRS("id")%>" class="answers3"><%=objRS("tools")%></div><br>
</div>
</td><td width="60%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" valign="top">
<td height="80" valign="top"><div class="latestcontain1">Location: The Stories </div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<%
Function RegExpReplace(Str, Pattern, Replacement)
Set objRegExp = New RegExp
objRegExp.Pattern = Pattern
objRegExp.Global = True
objRegExp.ignoreCase = true
RegExpReplace = objRegExp.Replace(Str, Replacement)
Set objRegExp = Nothing
End Function
dim arrWords
strid = Request.QueryString("id")
strSQLText = "SELECT * from stories WHERE id = " & strid
strSQLWords = "SELECT title from glossary "
set rsWords = server.createobject("ADODB.recordset")
rsWords.ActiveConnection = strConnection
rsWords.Source = strSQLWords
rsWords.Open()
arrWords = rsWords.getRows()
rsWords.Close()
' Build regular expression for linking'
strPattern = "\b("
for i = 0 to ubound(arrWords, 2)
strPattern = strPattern & arrWords(0, i)
if i < uBound(arrWords, 2) then
strPattern = strPattern & "|"
end if
next
strPattern = strPattern & ")\b"
set rsText = server.createobject("ADODB.recordset")
rsText.ActiveConnection = strConnection
rsText.Source = strSQLText
rsText.Open()
strText = rsText("title")
strintro = rsText("introduction")
rsText.Close()
if not objRS.eof then
do while not objRS.eof
varPath = "http://www.domain.com/pdf/" & objRS("STORY_IDENTIFIER") & ".pdf"
Response.Write "<TD>"
Response.Write "<div id=indexContent><span class=""header"">"
Response.Write RegExpReplace(strText, strPattern, "<a href=""http://www.domain.com</a>")
Response.Write"</span>"
Response.Write RegExpReplace(strintro, strPattern, "<a href=""http://www.domain.com</a>")
Response.Write objRS("RELEVENT")
Response.Write objRS("FULLTEXTLINK")
Response.Write "<span class=""header"">View or print the story</span>" & "<a href=""" & varPath & """ target=""_blank"">" & "<br><br>" & "PDF" & "</a>"
Response.Write "</TD>"
objRS.movenext
loop
else
response.write "No stories matched your search."
end if
objRS.Close
set objRS = Nothing
objConn.Close
set objConn = Nothing
%>
What is going wrong?
Cheers