Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Newbie question: error code
Old 09-22-2005, 12:32 PM Newbie question: error code
Daman's Avatar
Extreme Talker

Posts: 157
Location: Toronto, CANADA
Trades: 0
I am building a blogger for the first time. I am stumped now because of an error code when I test the page. Any help would be much appreciated.

Error:

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/blog/Default.asp, line 45

-----------------------------------------------------------------------------------------------------

Source code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/connBlog.asp" -->
<%
Dim rsPosts__MMColParam
rsPosts__MMColParam = "True"
If (Request("MM_EmptyValue") <> "") Then
rsPosts__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsPosts__MMColParam2
rsPosts__MMColParam2 = "1/1/2003"
If (Now() -7 <> "") Then
rsPosts__MMColParam2 = Now() -7
End If
%>
<%
Dim rsPosts
Dim rsPosts_numRows

Set rsPosts = Server.CreateObject("ADODB.Recordset")
rsPosts.ActiveConnection = MM_connBlog_STRING
rsPosts.Source = "SELECT dtePostDate, intCatID, intPostBy, intPostID, memPostContent, txtPostTitle, txtNickName FROM tblBlog, tblUsers WHERE bitPostShow = " + Replace(rsPosts__MMColParam, "'", "''") + " AND tblBlog.intPostby = tblUsers.intUserID AND dtePostDate > #" + Replace(rsPosts__MMColParam2, "'", "''") + "# ORDER BY dtePostDate DESC"
rsPosts.CursorType = 0
rsPosts.CursorLocation = 2
rsPosts.LockType = 1
rsPosts.Open()

rsPosts_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>The Blog</title>
<link href="myblog.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>It's my blog...<br />
<span class="smallprint">(comments on the yellow will not be tolerated)</span> </h1>
<table id="tableBlog">
<tr valign="top">
<td id="tdCategories">&nbsp;</td>
<td><div class="divPost">
<p><%=(rsPosts.Fields.Item("txtPostTitle").Value)% ></p>
</div></td>
</tr>
</table>
</body>
</html>
<%
rsPosts.Close()
Set rsPosts = Nothing
%>
Daman is offline
Reply With Quote
View Public Profile Visit Daman's homepage!
 
 
Register now for full access!
Old 09-22-2005, 03:41 PM
Daman's Avatar
Extreme Talker

Posts: 157
Location: Toronto, CANADA
Trades: 0
I went over all my code thoroughly and still I cannot resolve this error I keep getting. Everything seems to be in correct. I don't get it. Can anyone help me please?
Daman is offline
Reply With Quote
View Public Profile Visit Daman's homepage!
 
Old 09-22-2005, 04:29 PM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
When it complains about EOF or BOF being true, it means that your trying to use a recordset from the database that didn't return any results.
EOF = End of File
BOF = Beginning of File

After you open a recordset, you need to check if EOF and BOF is true, if they are then you can't use it to get data from.

Code:
rsPosts.Open()

if rsPosts.EOF and rsPosts.BOF then
    response.write "Sorry, no posts found"
else
    rsPosts_numRows = 0
    ...
    ' code to display results go here.
end if
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 09-22-2005, 05:20 PM
Daman's Avatar
Extreme Talker

Posts: 157
Location: Toronto, CANADA
Trades: 0
I understand and thank you for explaining. But I am a newbie and I dont quite know how to resolve this issue. Could this please be explained to me in a more detail?
Daman is offline
Reply With Quote
View Public Profile Visit Daman's homepage!
 
Old 09-22-2005, 05:27 PM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
I've modified the code you posted above to check for EOF and BOF, please be advised that I have not tested it and can't guarantee it to work. My changes are marked in red.
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/connBlog.asp" -->
<%
Dim rsPosts__MMColParam
rsPosts__MMColParam = "True"
If (Request("MM_EmptyValue") <> "") Then 
rsPosts__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim rsPosts__MMColParam2
rsPosts__MMColParam2 = "1/1/2003"
If (Now() -7 <> "") Then 
rsPosts__MMColParam2 = Now() -7
End If
%>
<%
Dim rsPosts
Dim rsPosts_numRows

Set rsPosts = Server.CreateObject("ADODB.Recordset")
rsPosts.ActiveConnection = MM_connBlog_STRING
rsPosts.Source = "SELECT dtePostDate, intCatID, intPostBy, intPostID, memPostContent, txtPostTitle, txtNickName FROM tblBlog, tblUsers WHERE bitPostShow = " + Replace(rsPosts__MMColParam, "'", "''") + " AND tblBlog.intPostby = tblUsers.intUserID AND dtePostDate > #" + Replace(rsPosts__MMColParam2, "'", "''") + "# ORDER BY dtePostDate DESC"
rsPosts.CursorType = 0
rsPosts.CursorLocation = 2
rsPosts.LockType = 1
rsPosts.Open()

rsPosts_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>The Blog</title>
<link href="myblog.css" rel="stylesheet" type="text/css" />
</head>
<body> 
<h1>It's my blog...<br /> 

<%
if rsPosts.EOF and rsPosts.BOF then
    response.write "Sorry, there is nothing to view";
else
%>
    <span class="smallprint">(comments on the yellow will not be tolerated)</span> </h1> 
    <table id="tableBlog"> 
    <tr valign="top"> 
    <td id="tdCategories">&nbsp;</td> 
    <td><div class="divPost">
    <p><%=(rsPosts.Fields.Item("txtPostTitle").Value)%></p>
    </div></td> 
    </tr> 
    </table> 
<%
end if
<%

</body>
</html>
<%
rsPosts.Close()
Set rsPosts = Nothing
%>
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 09-22-2005, 11:59 PM
Daman's Avatar
Extreme Talker

Posts: 157
Location: Toronto, CANADA
Trades: 0
I tryed it with the added code you provided in the red and I get this...

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/blog/Default.asp, line 42

response.write "Sorry, there is nothing to view";
------------------------------------------------^


I've gone over everything and it should work according to this tutorial training.

I'm at a wall with this.
Daman is offline
Reply With Quote
View Public Profile Visit Daman's homepage!
 
Old 09-23-2005, 12:08 AM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
Oops, sorry. Remove the semi-colon at the end of that line.

That's what happens when you program in multiple languages
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 09-23-2005, 11:53 AM
Daman's Avatar
Extreme Talker

Posts: 157
Location: Toronto, CANADA
Trades: 0
Thanks Anacrusis. I dont get the error message anymore. But what's really strange is that there should be data displayed instead of "Sorry, there is nothing to view". I know for a fact that there is data in my database file and it is set to true. When I test it in Dreamweaver MX it displays all active posts I set in the database which should display on my testing page.
Daman is offline
Reply With Quote
View Public Profile Visit Daman's homepage!
 
Old 09-23-2005, 02:52 PM
Daman's Avatar
Extreme Talker

Posts: 157
Location: Toronto, CANADA
Trades: 0
Why isnt my post appearing the my testing page. Here is the statement I am using to display the "Post Title"...

<p><%=(rsPosts.Fields.Item("txtPostTitle").Value)% ></p>

You can find this same statement in the original source code I provided in this post.

I'm out of ideas here...
According to the tutorial it should show the Post Title within that <div>
Daman is offline
Reply With Quote
View Public Profile Visit Daman's homepage!
 
Old 09-23-2005, 03:00 PM
Daman's Avatar
Extreme Talker

Posts: 157
Location: Toronto, CANADA
Trades: 0
GOT IT!!! I knew it would be something so dumb! lol I figured out the problem. The dates of the posts were older than 7 days therefore would not be displayed. I remembered I used a vbscript Now() -7 in my variable to show only the last 7 days. Feels good to solve something as a newbie. Thanks for all your help Anacrusis. you rock!
Daman is offline
Reply With Quote
View Public Profile Visit Daman's homepage!
 
Reply     « Reply to Newbie question: error code
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29897 seconds with 12 queries