|
 |
asp_databases thread: Getting EOf or BOF error with this
Message #1 by "Dave Parkins" <dave.parkins@m...> on Thu, 15 Aug 2002 17:25:50
|
|
Don't know why but I'm getting the EOF or BOF error when I try to run
this basic query. There is data in the database as well. Please help.
Thank you,
Dave
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%
strConnString = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=d:\test.mdb"
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
MyDay = Day(Now)
MyMonth = Month(Now)
MyYear = Year(Now)
MyDate = MyMonth & "/" & MyDay & "/" & MyYear
strSql = "SELECT * FROM diary WHERE dte = 8/15/02"
set rsLunch = my_Conn.Execute(strSql)
Do While Not rsLunch.EOF
NewDate = rsLunch("dte")
LunchToday = rsLunch("text_field")
rsLunch.MoveNext
Loop
%>
<TITLE> T E S T E S T E S T E S T E S T</TITLE>
<LINK REL=stylesheet TYPE="text/css" HREF="../high/hscss.css">
<SCRIPT LANGUAGE="JavaScript1.2" SRC="../high/hsmenuW.js"></SCRIPT>
</HEAD>
<TABLE WIDTH=640 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD WIDTH=640 VALIGN="top" ALIGN="center">
<BR><BR>
<TABLE ID="test" CELLSPACING="0" CELLPADDING="5"
WIDTH="610" BORDER="0">
<TR><TD ALIGN="center"><FONT SIZE="-1"><%
=rsLunch("dte")%></FONT></TD></TR>
<TR><TD ALIGN="center"><FONT><%=MyDate%
></FONT></TD></TR>
</TABLE>
<BR>
</TD></TR></TABLE>
</BODY>
</HTML>
Message #2 by "Jack Dunstan" <jdunstan7@h...> on Thu, 15 Aug 2002 12:41:11 -0400
|
|
Dave,
On the string below I believe you need single quotes around your date like
'8/15/02'" - try that.
strSql = "SELECT * FROM diary WHERE dte = 8/15/02"
hth
Jack
----- Original Message -----
From: "Dave Parkins" <dave.parkins@m...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, August 15, 2002 5:25 PM
Subject: [asp_databases] Getting EOf or BOF error with this
> Don't know why but I'm getting the EOF or BOF error when I try to run
> this basic query. There is data in the database as well. Please help.
>
> Thank you,
> Dave
>
> <%@ Language=VBScript %>
> <HTML>
> <HEAD>
> <%
> strConnString = "DRIVER={Microsoft Access Driver (*.mdb)};
> DBQ=d:\test.mdb"
>
> set my_Conn = Server.CreateObject("ADODB.Connection")
> my_Conn.Open strConnString
>
> MyDay = Day(Now)
> MyMonth = Month(Now)
> MyYear = Year(Now)
> MyDate = MyMonth & "/" & MyDay & "/" & MyYear
> strSql = "SELECT * FROM diary WHERE dte = 8/15/02"
> set rsLunch = my_Conn.Execute(strSql)
> Do While Not rsLunch.EOF
> NewDate = rsLunch("dte")
> LunchToday = rsLunch("text_field")
> rsLunch.MoveNext
> Loop
>
> %>
>
> <TITLE> T E S T E S T E S T E S T E S T</TITLE>
> <LINK REL=stylesheet TYPE="text/css" HREF="../high/hscss.css">
> <SCRIPT LANGUAGE="JavaScript1.2" SRC="../high/hsmenuW.js"></SCRIPT>
> </HEAD>
>
> <TABLE WIDTH=640 BORDER=0 CELLPADDING=0 CELLSPACING=0>
> <TR>
> <TD WIDTH=640 VALIGN="top" ALIGN="center">
> <BR><BR>
>
> <TABLE ID="test" CELLSPACING="0" CELLPADDING="5"
> WIDTH="610" BORDER="0">
> <TR><TD ALIGN="center"><FONT SIZE="-1"><%
> =rsLunch("dte")%></FONT></TD></TR>
> <TR><TD ALIGN="center"><FONT><%=MyDate%
> ></FONT></TD></TR>
> </TABLE>
> <BR>
> </TD></TR></TABLE>
>
>
>
> </BODY>
> </HTML>
>
Message #3 by "Gillian Harber" <gillian@m...> on Thu, 15 Aug 2002 17:51:21 +0100
|
|
try
strSql = "SELECT * FROM diary WHERE dte = #8/15/02#"
Gillian
----- Original Message -----
From: "Dave Parkins" <dave.parkins@m...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, August 15, 2002 5:25 PM
Subject: [asp_databases] Getting EOf or BOF error with this
> Don't know why but I'm getting the EOF or BOF error when I try to run
> this basic query. There is data in the database as well. Please help.
>
> Thank you,
> Dave
>
> <%@ Language=VBScript %>
> <HTML>
> <HEAD>
> <%
> strConnString = "DRIVER={Microsoft Access Driver (*.mdb)};
> DBQ=d:\test.mdb"
>
> set my_Conn = Server.CreateObject("ADODB.Connection")
> my_Conn.Open strConnString
>
> MyDay = Day(Now)
> MyMonth = Month(Now)
> MyYear = Year(Now)
> MyDate = MyMonth & "/" & MyDay & "/" & MyYear
> strSql = "SELECT * FROM diary WHERE dte = 8/15/02"
> set rsLunch = my_Conn.Execute(strSql)
> Do While Not rsLunch.EOF
> NewDate = rsLunch("dte")
> LunchToday = rsLunch("text_field")
> rsLunch.MoveNext
> Loop
>
> %>
>
> <TITLE> T E S T E S T E S T E S T E S T</TITLE>
> <LINK REL=stylesheet TYPE="text/css" HREF="../high/hscss.css">
> <SCRIPT LANGUAGE="JavaScript1.2" SRC="../high/hsmenuW.js"></SCRIPT>
> </HEAD>
>
> <TABLE WIDTH=640 BORDER=0 CELLPADDING=0 CELLSPACING=0>
> <TR>
> <TD WIDTH=640 VALIGN="top" ALIGN="center">
> <BR><BR>
>
> <TABLE ID="test" CELLSPACING="0" CELLPADDING="5"
> WIDTH="610" BORDER="0">
> <TR><TD ALIGN="center"><FONT SIZE="-1"><%
> =rsLunch("dte")%></FONT></TD></TR>
> <TR><TD ALIGN="center"><FONT><%=MyDate%
> ></FONT></TD></TR>
> </TABLE>
> <BR>
> </TD></TR></TABLE>
>
>
>
> </BODY>
> </HTML>
>
Message #4 by "Dave Parkins" <dave.parkins@m...> on Thu, 15 Aug 2002 18:01:21
|
|
Jack, thanks for the reply. I've even tried a basic sql structure like:
"SELECT * FROM diary"
and I still get the eof or bof error.
Thanks,
Dave
Message #5 by "Kim Iwan Hansen" <kimiwan@k...> on Thu, 15 Aug 2002 19:01:34 +0200
|
|
You're trying to get the value for rsLunch("dte") in the middle of your html
code - you probably want to use the value for NewDate instead.
Also, you need to put ## around date values in Access.
You could possibly rewrite your sql statement to something like this:
"SELECT dte, text_field FROM diary WHERE DateValue(dte) = DateValue(Date())"
-Kim
> -----Original Message-----
> From: Dave Parkins [mailto:dave.parkins@m...]
> Sent: 15. august 2002 17:26
> To: ASP Databases
> Subject: [asp_databases] Getting EOf or BOF error with this
>
>
> Don't know why but I'm getting the EOF or BOF error when I try to run
> this basic query. There is data in the database as well. Please help.
>
> Thank you,
> Dave
>
> <%@ Language=VBScript %>
> <HTML>
> <HEAD>
> <%
> strConnString = "DRIVER={Microsoft Access Driver (*.mdb)};
> DBQ=d:\test.mdb"
>
> set my_Conn = Server.CreateObject("ADODB.Connection")
> my_Conn.Open strConnString
>
> MyDay = Day(Now)
> MyMonth = Month(Now)
> MyYear = Year(Now)
> MyDate = MyMonth & "/" & MyDay & "/" & MyYear
> strSql = "SELECT * FROM diary WHERE dte = 8/15/02"
> set rsLunch = my_Conn.Execute(strSql)
> Do While Not rsLunch.EOF
> NewDate = rsLunch("dte")
> LunchToday = rsLunch("text_field")
> rsLunch.MoveNext
> Loop
>
> %>
>
> <TITLE> T E S T E S T E S T E S T E S T</TITLE>
> <LINK REL=stylesheet TYPE="text/css" HREF="../high/hscss.css">
> <SCRIPT LANGUAGE="JavaScript1.2" SRC="../high/hsmenuW.js"></SCRIPT>
> </HEAD>
>
> <TABLE WIDTH=640 BORDER=0 CELLPADDING=0 CELLSPACING=0>
> <TR>
> <TD WIDTH=640 VALIGN="top" ALIGN="center">
> <BR><BR>
>
> <TABLE ID="test" CELLSPACING="0" CELLPADDING="5"
> WIDTH="610" BORDER="0">
> <TR><TD ALIGN="center"><FONT SIZE="-1"><%
> =rsLunch("dte")%></FONT></TD></TR>
> <TR><TD ALIGN="center"><FONT><%=MyDate%
> ></FONT></TD></TR>
> </TABLE>
> <BR>
> </TD></TR></TABLE>
>
>
>
> </BODY>
> </HTML>
Message #6 by "Drew, Ron" <RDrew@B...> on Thu, 15 Aug 2002 13:07:25 -0400
|
|
Do a
strSql =3D "SELECT Count(*) as totrecds FROM diary"
Response.write rsLunch("totrecds")
'see how many records are in the diary table
-----Original Message-----
From: Gillian Harber [mailto:gillian@m...]
Sent: Thursday, August 15, 2002 12:51 PM
To: ASP Databases
Subject: [asp_databases] Re: Getting EOf or BOF error with this
try
strSql =3D "SELECT * FROM diary WHERE dte =3D #8/15/02#"
Gillian
----- Original Message -----
From: "Dave Parkins" <dave.parkins@m...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, August 15, 2002 5:25 PM
Subject: [asp_databases] Getting EOf or BOF error with this
> Don't know why but I'm getting the EOF or BOF error when I try to run
> this basic query. There is data in the database as well. Please help.
>
> Thank you,
> Dave
>
> <%@ Language=3DVBScript %>
> <HTML>
> <HEAD>
> <%
> strConnString =3D "DRIVER=3D{Microsoft Access Driver (*.mdb)};
> DBQ=3Dd:\test.mdb"
>
> set my_Conn =3D Server.CreateObject("ADODB.Connection")
> my_Conn.Open strConnString
>
> MyDay =3D Day(Now)
> MyMonth =3D Month(Now)
> MyYear =3D Year(Now)
> MyDate =3D MyMonth & "/" & MyDay & "/" & MyYear
> strSql =3D "SELECT * FROM diary WHERE dte =3D 8/15/02"
> set rsLunch =3D my_Conn.Execute(strSql)
> Do While Not rsLunch.EOF
> NewDate =3D rsLunch("dte")
> LunchToday =3D rsLunch("text_field")
> rsLunch.MoveNext
> Loop
>
> %>
>
> <TITLE> T E S T E S T E S T E S T E S T</TITLE>
> <LINK REL=3Dstylesheet TYPE=3D"text/css" HREF=3D"../high/hscss.css">
<SCRIPT
> LANGUAGE=3D"JavaScript1.2" SRC=3D"../high/hsmenuW.js"></SCRIPT>
> </HEAD>
>
> <TABLE WIDTH=3D640 BORDER=3D0 CELLPADDING=3D0 CELLSPACING=3D0>
> <TR>
> <TD WIDTH=3D640 VALIGN=3D"top" ALIGN=3D"center">
> <BR><BR>
>
> <TABLE ID=3D"test" CELLSPACING=3D"0" CELLPADDING=3D"5"
> WIDTH=3D"610" BORDER=3D"0">
> <TR><TD ALIGN=3D"center"><FONT SIZE=3D"-1"><%
> =3DrsLunch("dte")%></FONT></TD></TR>
> <TR><TD ALIGN=3D"center"><FONT><%=3DMyDate%
> ></FONT></TD></TR>
> </TABLE>
> <BR>
> </TD></TR></TABLE>
>
>
>
> </BODY>
> </HTML>
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to
> unsubscribe send a blank email to
>
Message #7 by "Dave Parkins" <dave.parkins@m...> on Thu, 15 Aug 2002 18:29:39
|
|
I have around 50 records in the table by just looking at it.
Thanks,
Dave
Message #8 by "Dave Parkins" <dave.parkins@m...> on Thu, 15 Aug 2002 18:41:41
|
|
Ok, I get a different error now.
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/000_conn/test.asp, line 13
This is my current code, any ideas? And I really appreciate all your help.
Dave
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%
strConnString = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=d:\test.mdb"
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
MyDay = Day(Now)
MyMonth = Month(Now)
MyYear = Year(Now)
MyDate = MyMonth & "/" & MyDay & "/" & MyYear
*line 13>* If Not rsLunch.EOF Then
Do Until rsLunch.EOF
strSql = "SELECT * FROM diary"
set rsLunch = my_Conn.Execute(strSql)
rsLunch.MoveNext
Loop
End IF
%>
<% dim NewDate, LunchToday
NewDate = rsLunch("dte")
LunchToday = rsLunch("text_field")
%>
<TITLE> T E S T E S T E S T E S T E S T</TITLE>
</HEAD>
<TABLE WIDTH=640 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD WIDTH=640 VALIGN="top" ALIGN="center">
<BR><BR>
<TABLE ID="test" CELLSPACING="0" CELLPADDING="5"
WIDTH="610" BORDER="0">
<TR><TD ALIGN="center"><FONT SIZE="-1"><%
=rsLunch("dte")%></FONT></TD></TR>
<TR><TD ALIGN="center"><FONT><%=MyDate%
></FONT></TD></TR>
</TABLE>
<BR>
</TD></TR></TABLE>
</BODY>
</HTML>
Message #9 by "Owen Mortensen" <ojm@a...> on Thu, 15 Aug 2002 11:04:27 -0700
|
|
If this is all the code, then you haven't set rsLunch to anything by the
time you get to line 13. Why do you have, inside the rsLunc.EOF loop, a
query that resets rsLunch?
Owen
-----Original Message-----
From: Dave Parkins [mailto:dave.parkins@m...]
Sent: Thursday, August 15, 2002 6:42 PM
To: ASP Databases
Subject: [asp_databases] Re: Getting EOf or BOF error with this
Ok, I get a different error now.
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/000_conn/test.asp, line 13
This is my current code, any ideas? And I really appreciate all your
help.
Dave
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%
strConnString = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=d:\test.mdb"
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
MyDay = Day(Now)
MyMonth = Month(Now)
MyYear = Year(Now)
MyDate = MyMonth & "/" & MyDay & "/" & MyYear
*line 13>* If Not rsLunch.EOF Then
Do Until rsLunch.EOF
strSql = "SELECT * FROM diary"
set rsLunch = my_Conn.Execute(strSql)
rsLunch.MoveNext
Loop
End IF
%>
<% dim NewDate, LunchToday
NewDate = rsLunch("dte")
LunchToday = rsLunch("text_field")
%>
<TITLE> T E S T E S T E S T E S T E S T</TITLE>
</HEAD>
<TABLE WIDTH=640 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD WIDTH=640 VALIGN="top" ALIGN="center">
<BR><BR>
<TABLE ID="test" CELLSPACING="0" CELLPADDING="5"
WIDTH="610" BORDER="0">
<TR><TD ALIGN="center"><FONT
SIZE="-1"><% =rsLunch("dte")%></FONT></TD></TR>
<TR><TD ALIGN="center"><FONT><%=MyDate%
></FONT></TD></TR>
</TABLE>
<BR>
</TD></TR></TABLE>
</BODY>
</HTML>
Message #10 by "Drew, Ron" <RDrew@B...> on Thu, 15 Aug 2002 14:20:28 -0400
|
|
Try this..
<%
strConnString =3D "DRIVER=3D{Microsoft Access Driver (*.mdb)};
DBQ=3Dd:\test.mdb"
set my_Conn =3D Server.CreateObject("ADODB.Connection")
set rsLunch =3D server.CreateObject("ADODB.Recordset")
my_Conn.Open strConnString
MyDay =3D Day(Now)
MyMonth =3D Month(Now)
MyYear =3D Year(Now)
MyDate =3D MyMonth & "/" & MyDay & "/" & MyYear
strSql =3D "SELECT * FROM diary"
set rsLunch =3D my_Conn.Execute(strSql)
if rsLunch.BOF and rsLunch.EOF then
' NO ROWS
' Output something.
else
rsLunch.MoveFirst ' Just to be sure.
while not rsLunch.EOF ' While there are more records
' Do stuff with a row here
rsLunch.movenext ' Go to the next record, or set EOF if no more
records.
wend
end if
%>
-----Original Message-----
From: Dave Parkins [mailto:dave.parkins@m...]
Sent: Thursday, August 15, 2002 2:42 PM
To: ASP Databases
Subject: [asp_databases] Re: Getting EOf or BOF error with this
Ok, I get a different error now.
Microsoft VBScript runtime error '800a01a8'
Object required: ''
/000_conn/test.asp, line 13
This is my current code, any ideas? And I really appreciate all your
help.
Dave
<%@ Language=3DVBScript %>
<HTML>
<HEAD>
<%
strConnString =3D "DRIVER=3D{Microsoft Access Driver (*.mdb)};
DBQ=3Dd:\test.mdb"
set my_Conn =3D Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
MyDay =3D Day(Now)
MyMonth =3D Month(Now)
MyYear =3D Year(Now)
MyDate =3D MyMonth & "/" & MyDay & "/" & MyYear
*line 13>* If Not rsLunch.EOF Then
Do Until rsLunch.EOF
strSql =3D "SELECT * FROM diary"
set rsLunch =3D my_Conn.Execute(strSql)
rsLunch.MoveNext
Loop
End IF
%>
<% dim NewDate, LunchToday
NewDate =3D rsLunch("dte")
LunchToday =3D rsLunch("text_field")
%>
<TITLE> T E S T E S T E S T E S T E S T</TITLE>
</HEAD>
<TABLE WIDTH=3D640 BORDER=3D0 CELLPADDING=3D0 CELLSPACING=3D0>
<TR>
<TD WIDTH=3D640 VALIGN=3D"top" ALIGN=3D"center">
<BR><BR>
<TABLE ID=3D"test" CELLSPACING=3D"0" CELLPADDING=3D"5"
WIDTH=3D"610" BORDER=3D"0">
<TR><TD ALIGN=3D"center"><FONT
SIZE=3D"-1"><% =3DrsLunch("dte")%></FONT></TD></TR>
<TR><TD ALIGN=3D"center"><FONT><%=3DMyDate%
></FONT></TD></TR>
</TABLE>
<BR>
</TD></TR></TABLE>
</BODY>
</HTML>
Message #11 by "Dave Parkins" <dave.parkins@m...> on Thu, 15 Aug 2002 20:38:10
|
|
This is what I tried and I get the old error again.
Error:
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.
/000_conn/test.asp, line 0
Any ideas?
Code:
<%
strConnString = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=d:\admin\000_conn\rds.mdb"
set my_Conn = Server.CreateObject("ADODB.Connection")
set rsLunch = server.CreateObject("ADODB.Recordset")
my_Conn.Open strConnString
strSql = "SELECT * FROM Customer"
set rsLunch = my_Conn.Execute(strSql)
if rsLunch.BOF or rsLunch.EOF then
response.write "There was an error"
else
rsLunch.MoveFirst
while not rsLunch.EOF
rsLunch.movenext
wend
end if
%>
Message #12 by "Jack Dunstan" <jdunstan7@h...> on Thu, 15 Aug 2002 16:04:02 -0400
|
|
Dave,
If you didn't get it to work yet try executing the recordset by itself:
like below
<%
strConnString = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=d:\admin\000_conn\rds.mdb"
set my_Conn = Server.CreateObject("ADODB.Connection")
set rsLunch = server.CreateObject("ADODB.Recordset")
my_Conn.Open strConnString
strSql = "SELECT * FROM Customer"
rsLunch.Open strSql
if rsLunch.BOF or rsLunch.EOF then
response.write "There was an error"
else
while not rsLunch.EOF
response.write rsLunch("SomeFieldName").value
rsLunch.movenext
wend
end if
%>
hth
Jack
----- Original Message -----
From: "Dave Parkins" <dave.parkins@m...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, August 15, 2002 8:38 PM
Subject: [asp_databases] Re: Getting EOf or BOF error with this
> This is what I tried and I get the old error again.
>
> Error:
>
> ADODB.Field error '80020009'
>
> Either BOF or EOF is True, or the current record has been deleted.
> Requested operation requires a current record.
>
> /000_conn/test.asp, line 0
>
> Any ideas?
>
>
> Code:
>
> <%
> strConnString = "DRIVER={Microsoft Access Driver (*.mdb)};
> DBQ=d:\admin\000_conn\rds.mdb"
> set my_Conn = Server.CreateObject("ADODB.Connection")
> set rsLunch = server.CreateObject("ADODB.Recordset")
> my_Conn.Open strConnString
> strSql = "SELECT * FROM Customer"
> set rsLunch = my_Conn.Execute(strSql)
> if rsLunch.BOF or rsLunch.EOF then
> response.write "There was an error"
> else
> rsLunch.MoveFirst
> while not rsLunch.EOF
> rsLunch.movenext
> wend
> end if
>
> %>
>
>
Message #13 by "Dave Parkins" <dave.parkins@m...> on Thu, 15 Aug 2002 21:22:58
|
|
I got it to work. Thank you all for your help.
Dave
<%
strConnString = "DRIVER={Microsoft Access Driver (*.mdb)};
DBQ=d:\admin\000_conn\rds.mdb"
set my_Conn = Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
set rsLunch = server.CreateObject("ADODB.Recordset")
dim MyDay,MyMonth,MyYear,MyDate
MyDay = Day(Now)
MyMonth = Month(Now)
MyYear = Year(Now)
MyDate = MyMonth & "/" & MyDay & "/" & MyYear
strSql = "SELECT * FROM Customer"
set rsLunch = my_Conn.Execute(strSql)
If not rsLunch.EOF then
else
' problem creating
' ?? what to do
rsLunch.MoveFirst
while not rsLunch.EOF
rsLunch.movenext
wend
end if
%>
|
|
 |