|
 |
asp_web_howto thread: Either BOF or EOF is True, or the current record has been deleted.
Message #1 by "Evan" <raisy@w...> on Tue, 19 Feb 2002 13:10:04
|
|
Hello everybody,
I'm still a bit of a newbee here with ASP, but I'm learning :o)
One lil question I have is WHERE to put the following code in my script
so I will not get error messages saying
*************************************
THe wellknown error :o| (for me at least)
*************************************
Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.:
----------------------------
I have been trying different things, but can't have the page to load
WITHOUT getting that error when there is no recordset available (this
might occur once in a while.....)
Thank you so much for all of your help!
Evan
----------------------------
*************************************
Code
*************************************
<% If Not WHATRECORDSET????.EOF Or Not WHATRECORDSET????.BOF Then %>
<% End If %>
*************************************
My Advertisement Rotation Script
*************************************
<%
Dim objConn
Dim objRst
Dim strSQL
Dim strConnection
Dim str
Dim str1
Dim cnt
Dim cnt1
Dim rndMax
Dim RndNumber
strConnection="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\WWWRoot\myserver\Database\dd.mdb"
strSQL = "SELECT AdvertisementSideID, Show, SiteCategoryID FROM
tblAdvertisementSide WHERE Show = 'Y' AND SiteCategoryID = 10"
set objConn = Server.CreateObject("ADODB.Connection")
Set objRst = Server.CreateObject("ADODB.Recordset")
objConn.Open strConnection
set objRst.ActiveConnection = objConn
objRst.LockType = adLockOptimistic
objRst.CursorType = adOpenKeySet
objRst.Open strSQL
objRst.MoveLast
cnt = objRst.RecordCount
cnt1 = cnt
rndMax = cnt
If CInt(3) < cnt Then
cnt1 = CInt(3)
End If
str = ","
str1 = ","
Do Until cnt1 = 0
Randomize
RndNumber = Int(Rnd * rndMax)
If (InStr(1, str1, "," & RndNumber & "," ) = 0) Then
str1 = str1 & RndNumber & ","
cnt1 = cnt1 - 1
objRst.MoveFirst
objRst.Move RndNumber
str = str & objRst("AdvertisementSideID") & ","
End If
Loop
objRst.Close
Set objRst = Nothing
sql = "SELECT * FROM tblAdvertisementSide WHERE (((InStr(1,'" & str & "',
(',' & [AdvertisementSideID] & ',')))<>0)) ORDER BY Rnd(IsNull
([AdvertisementSideID])*0+1)"
Set objRst = Server.CreateObject("ADODB.Recordset")
set objRst.ActiveConnection = objConn
objRst.LockType = adLockOptimistic
objRst.CursorType = adOpenStatic
objRst.Open sql
%>
<%
Dim Repeat101__numRows
Repeat101__numRows = -1
Dim Repeat101__index
Repeat101__index = 0
objRst_numRows = objRst_numRows + Repeat101__numRows
%>
<%
While ((Repeat101__numRows <> 0) AND (NOT objRst.EOF))
%>
</p>
<a href="../redirect_side.asp?AdvertisementSideID=<%
=objRst.Fields("AdvertisementSideID")%>" target="_blank"><img border="0"
alt="<%=objRst.Fields("ImgAlt")%>"
src="../uploads/img/advertisment_side/<%=objRst.Fields("ImgSrc")%
>"></a><br>
<%
Repeat101__index=Repeat101__index+1
objRst.MoveNext()
Wend
%>
<%
objRst.Close
Set objRst = Nothing
objConn.Close
Set objConn = Nothing
%>
Message #2 by Joe Ingle <Joe@k...> on Tue, 19 Feb 2002 00:57:38 -0000
|
|
you need to write something along the lines of:
if rs.eof then
response.write(" <P>Sorry, No records</P> ")
else
response.write(" "& rs("WhateverField") &" ")
end if
Joe
-----Original Message-----
From: Evan [mailto:raisy@w...]
Sent: Tuesday, February 19, 2002 01:10
To: ASP Web HowTo
Subject: [asp_web_howto] Either BOF or EOF is True, or the current
record has been deleted.
Hello everybody,
I'm still a bit of a newbee here with ASP, but I'm learning :o)
One lil question I have is WHERE to put the following code in my script
so I will not get error messages saying
*************************************
THe wellknown error :o| (for me at least)
*************************************
Error Type:
ADODB.Recordset (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted.
Requested operation requires a current record.:
----------------------------
I have been trying different things, but can't have the page to load
WITHOUT getting that error when there is no recordset available (this
might occur once in a while.....)
Thank you so much for all of your help!
Evan
----------------------------
*************************************
Code
*************************************
<% If Not WHATRECORDSET????.EOF Or Not WHATRECORDSET????.BOF Then %>
<% End If %>
*************************************
My Advertisement Rotation Script
*************************************
<%
Dim objConn
Dim objRst
Dim strSQL
Dim strConnection
Dim str
Dim str1
Dim cnt
Dim cnt1
Dim rndMax
Dim RndNumber
strConnection="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\WWWRoot\myserver\Database\dd.mdb"
strSQL = "SELECT AdvertisementSideID, Show, SiteCategoryID FROM
tblAdvertisementSide WHERE Show = 'Y' AND SiteCategoryID = 10"
set objConn = Server.CreateObject("ADODB.Connection")
Set objRst = Server.CreateObject("ADODB.Recordset")
objConn.Open strConnection
set objRst.ActiveConnection = objConn
objRst.LockType = adLockOptimistic
objRst.CursorType = adOpenKeySet
objRst.Open strSQL
objRst.MoveLast
cnt = objRst.RecordCount
cnt1 = cnt
rndMax = cnt
If CInt(3) < cnt Then
cnt1 = CInt(3)
End If
str = ","
str1 = ","
Do Until cnt1 = 0
Randomize
RndNumber = Int(Rnd * rndMax)
If (InStr(1, str1, "," & RndNumber & "," ) = 0) Then
str1 = str1 & RndNumber & ","
cnt1 = cnt1 - 1
objRst.MoveFirst
objRst.Move RndNumber
str = str & objRst("AdvertisementSideID") & ","
End If
Loop
objRst.Close
Set objRst = Nothing
sql = "SELECT * FROM tblAdvertisementSide WHERE (((InStr(1,'" & str & "',
(',' & [AdvertisementSideID] & ',')))<>0)) ORDER BY Rnd(IsNull
([AdvertisementSideID])*0+1)"
Set objRst = Server.CreateObject("ADODB.Recordset")
set objRst.ActiveConnection = objConn
objRst.LockType = adLockOptimistic
objRst.CursorType = adOpenStatic
objRst.Open sql
%>
<%
Dim Repeat101__numRows
Repeat101__numRows = -1
Dim Repeat101__index
Repeat101__index = 0
objRst_numRows = objRst_numRows + Repeat101__numRows
%>
<%
While ((Repeat101__numRows <> 0) AND (NOT objRst.EOF))
%>
</p>
<a href="../redirect_side.asp?AdvertisementSideID=<%
=objRst.Fields("AdvertisementSideID")%>" target="_blank"><img border="0"
alt="<%=objRst.Fields("ImgAlt")%>"
src="../uploads/img/advertisment_side/<%=objRst.Fields("ImgSrc")%
>"></a><br>
<%
Repeat101__index=Repeat101__index+1
objRst.MoveNext()
Wend
%>
<%
objRst.Close
Set objRst = Nothing
objConn.Close
Set objConn = Nothing
%>
$subst('Email.Unsub').
Message #3 by "Evan / Raisor -> You know ;o)" <raisy@w...> on Tue, 19 Feb 2002 14:24:14 +0100
|
|
Thank you very much Joe,
I changed it into this and it works!, guess I shouldn't worry to much about
the coding then :o)
Evan
<%
Dim objConn
Dim objRst
Dim strSQL
Dim strConnection
Dim str
Dim str1
Dim cnt
Dim cnt1
Dim rndMax
Dim RndNumber
strConnection="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\WWWRoot\dupagedirectcom\Database\dd.mdb"
strSQL = "SELECT AdvertisementSideID, Show, SiteCategoryID FROM
tblAdvertisementSide WHERE Show = 'Y' AND SiteCategoryID = 10"
set objConn = Server.CreateObject("ADODB.Connection")
Set objRst = Server.CreateObject("ADODB.Recordset")
objConn.Open strConnection
set objRst.ActiveConnection = objConn
objRst.LockType = adLockOptimistic
objRst.CursorType = adOpenKeySet
objRst.Open strSQL
%>
<%
if objRst.eof then
response.write(" <P></P> ")
else
%>
<%
objRst.MoveLast
cnt = objRst.RecordCount
cnt1 = cnt
rndMax = cnt
If CInt(3) < cnt Then
cnt1 = CInt(3)
End If
str = ","
str1 = ","
Do Until cnt1 = 0
Randomize
RndNumber = Int(Rnd * rndMax)
If (InStr(1, str1, "," & RndNumber & "," ) = 0) Then
str1 = str1 & RndNumber & ","
cnt1 = cnt1 - 1
objRst.MoveFirst
objRst.Move RndNumber
str = str & objRst("AdvertisementSideID") & ","
End If
Loop
objRst.Close
Set objRst = Nothing
sql = "SELECT * FROM tblAdvertisementSide WHERE (((InStr(1,'" & str &
"',(',' & [AdvertisementSideID] & ',')))<>0)) ORDER BY
Rnd(IsNull([AdvertisementSideID])*0+1)"
Set objRst = Server.CreateObject("ADODB.Recordset")
set objRst.ActiveConnection = objConn
objRst.LockType = adLockOptimistic
objRst.CursorType = adOpenStatic
objRst.Open sql
%>
<%
Dim Repeat101__numRows
Repeat101__numRows = -1
Dim Repeat101__index
Repeat101__index = 0
objRst_numRows = objRst_numRows + Repeat101__numRows
%>
<%
While ((Repeat101__numRows <> 0) AND (NOT objRst.EOF))
%>
</p>
<a
href="../redirect_side.asp?AdvertisementSideID=<%=objRst.Fields("AdvertisementSideID")%>"
target="_blank"><img border="0" alt="<%=objRst.Fields("ImgAlt")%>"
src="uploads/img/advertisment_side/<%=objRst.Fields("ImgSrc")%>"></a><br>
<%
Repeat101__index=Repeat101__index+1
objRst.MoveNext()
Wend
%>
<% end if %>
<%
objRst.Close
Set objRst = Nothing
objConn.Close
Set objConn = Nothing
%>
At 12:57 AM 2/19/2002 +0000, you wrote:
>you need to write something along the lines of:
>
>if rs.eof then
>response.write(" <P>Sorry, No records</P> ")
>else
>response.write(" "& rs("WhateverField") &" ")
>end if
>
>Joe
>
>-----Original Message-----
>From: Evan [mailto:raisy@w...]
>Sent: Tuesday, February 19, 2002 01:10
>To: ASP Web HowTo
>Subject: [asp_web_howto] Either BOF or EOF is True, or the current
>record has been deleted.
>
>
>Hello everybody,
>
>I'm still a bit of a newbee here with ASP, but I'm learning :o)
>One lil question I have is WHERE to put the following code in my script
>so I will not get error messages saying
>
>*************************************
>THe wellknown error :o| (for me at least)
>*************************************
>Error Type:
>ADODB.Recordset (0x800A0BCD)
>Either BOF or EOF is True, or the current record has been deleted.
>Requested operation requires a current record.:
>
>----------------------------
>I have been trying different things, but can't have the page to load
>WITHOUT getting that error when there is no recordset available (this
>might occur once in a while.....)
>Thank you so much for all of your help!
>
>Evan
>----------------------------
>
>
>
>
>*************************************
>Code
>*************************************
><% If Not WHATRECORDSET????.EOF Or Not WHATRECORDSET????.BOF Then %>
><% End If %>
>
>
>*************************************
>My Advertisement Rotation Script
>*************************************
><%
>Dim objConn
>Dim objRst
>Dim strSQL
>Dim strConnection
>Dim str
>Dim str1
>Dim cnt
>Dim cnt1
>Dim rndMax
>Dim RndNumber
>
>strConnection="Provider=Microsoft.Jet.OLEDB.4.0;Data
>Source=D:\WWWRoot\myserver\Database\dd.mdb"
>strSQL = "SELECT AdvertisementSideID, Show, SiteCategoryID FROM
>tblAdvertisementSide WHERE Show = 'Y' AND SiteCategoryID = 10"
>
>set objConn = Server.CreateObject("ADODB.Connection")
>Set objRst = Server.CreateObject("ADODB.Recordset")
>objConn.Open strConnection
>set objRst.ActiveConnection = objConn
>objRst.LockType = adLockOptimistic
>objRst.CursorType = adOpenKeySet
>objRst.Open strSQL
>
>objRst.MoveLast
>cnt = objRst.RecordCount
>cnt1 = cnt
>rndMax = cnt
>
>If CInt(3) < cnt Then
>cnt1 = CInt(3)
>End If
>
>str = ","
>str1 = ","
>
>Do Until cnt1 = 0
>Randomize
>RndNumber = Int(Rnd * rndMax)
>
>If (InStr(1, str1, "," & RndNumber & "," ) = 0) Then
>str1 = str1 & RndNumber & ","
>cnt1 = cnt1 - 1
>objRst.MoveFirst
>objRst.Move RndNumber
>str = str & objRst("AdvertisementSideID") & ","
>End If
>
>Loop
>
>objRst.Close
>Set objRst = Nothing
>
>sql = "SELECT * FROM tblAdvertisementSide WHERE (((InStr(1,'" & str & "',
>(',' & [AdvertisementSideID] & ',')))<>0)) ORDER BY Rnd(IsNull
>([AdvertisementSideID])*0+1)"
>Set objRst = Server.CreateObject("ADODB.Recordset")
>set objRst.ActiveConnection = objConn
>objRst.LockType = adLockOptimistic
>objRst.CursorType = adOpenStatic
>objRst.Open sql
>%>
> <%
>Dim Repeat101__numRows
>Repeat101__numRows = -1
>Dim Repeat101__index
>Repeat101__index = 0
>objRst_numRows = objRst_numRows + Repeat101__numRows
>%>
> <%
>While ((Repeat101__numRows <> 0) AND (NOT objRst.EOF))
>%>
> </p>
> <a href="../redirect_side.asp?AdvertisementSideID=<%
>=objRst.Fields("AdvertisementSideID")%>" target="_blank"><img border="0"
>alt="<%=objRst.Fields("ImgAlt")%>"
>src="../uploads/img/advertisment_side/<%=objRst.Fields("ImgSrc")%
> >"></a><br>
> <%
> Repeat101__index=Repeat101__index+1
>
> objRst.MoveNext()
>Wend
>%>
> <%
>objRst.Close
>Set objRst = Nothing
>
>objConn.Close
>Set objConn = Nothing
>%>
>$subst('Email.Unsub').
>
Message #4 by "Alfredo Yong" <alfredo_yong_linux@h...> on Tue, 19 Feb 2002 11:32:18 -0500
|
|
You must test if rs.EOF before html generation.
rs.open ...
If Not rs.EOF THen
Response.Write "<p>" & rs("myField")
...
End If
--
=================================================================
Alfredo_Yong@h...
Freelance Developer - Web systems
Expertise in ASP, DHTML, CSS, jscript, php, SQL & etc.
Available to contract.
Evan <raisy@w...> escribió en el mensaje de noticias
147872@a..._web_howto...
>
> Hello everybody,
>
> I'm still a bit of a newbee here with ASP, but I'm learning :o)
> One lil question I have is WHERE to put the following code in my script
> so I will not get error messages saying
>
> *************************************
> THe wellknown error :o| (for me at least)
> *************************************
> Error Type:
> ADODB.Recordset (0x800A0BCD)
> Either BOF or EOF is True, or the current record has been deleted.
> Requested operation requires a current record.:
>
> ----------------------------
> I have been trying different things, but can't have the page to load
> WITHOUT getting that error when there is no recordset available (this
> might occur once in a while.....)
> Thank you so much for all of your help!
>
> Evan
> ----------------------------
>
>
>
>
> *************************************
> Code
> *************************************
> <% If Not WHATRECORDSET????.EOF Or Not WHATRECORDSET????.BOF Then %>
> <% End If %>
>
>
> *************************************
> My Advertisement Rotation Script
> *************************************
> <%
> Dim objConn
> Dim objRst
> Dim strSQL
> Dim strConnection
> Dim str
> Dim str1
> Dim cnt
> Dim cnt1
> Dim rndMax
> Dim RndNumber
>
> strConnection="Provider=Microsoft.Jet.OLEDB.4.0;Data
> Source=D:\WWWRoot\myserver\Database\dd.mdb"
> strSQL = "SELECT AdvertisementSideID, Show, SiteCategoryID FROM
> tblAdvertisementSide WHERE Show = 'Y' AND SiteCategoryID = 10"
>
> set objConn = Server.CreateObject("ADODB.Connection")
> Set objRst = Server.CreateObject("ADODB.Recordset")
> objConn.Open strConnection
> set objRst.ActiveConnection = objConn
> objRst.LockType = adLockOptimistic
> objRst.CursorType = adOpenKeySet
> objRst.Open strSQL
>
> objRst.MoveLast
> cnt = objRst.RecordCount
> cnt1 = cnt
> rndMax = cnt
>
> If CInt(3) < cnt Then
> cnt1 = CInt(3)
> End If
>
> str = ","
> str1 = ","
>
> Do Until cnt1 = 0
> Randomize
> RndNumber = Int(Rnd * rndMax)
>
> If (InStr(1, str1, "," & RndNumber & "," ) = 0) Then
> str1 = str1 & RndNumber & ","
> cnt1 = cnt1 - 1
> objRst.MoveFirst
> objRst.Move RndNumber
> str = str & objRst("AdvertisementSideID") & ","
> End If
>
> Loop
>
> objRst.Close
> Set objRst = Nothing
>
> sql = "SELECT * FROM tblAdvertisementSide WHERE (((InStr(1,'" & str & "',
> (',' & [AdvertisementSideID] & ',')))<>0)) ORDER BY Rnd(IsNull
> ([AdvertisementSideID])*0+1)"
> Set objRst = Server.CreateObject("ADODB.Recordset")
> set objRst.ActiveConnection = objConn
> objRst.LockType = adLockOptimistic
> objRst.CursorType = adOpenStatic
> objRst.Open sql
> %>
> <%
> Dim Repeat101__numRows
> Repeat101__numRows = -1
> Dim Repeat101__index
> Repeat101__index = 0
> objRst_numRows = objRst_numRows + Repeat101__numRows
> %>
> <%
> While ((Repeat101__numRows <> 0) AND (NOT objRst.EOF))
> %>
> </p>
> <a href="../redirect_side.asp?AdvertisementSideID=<%
> =objRst.Fields("AdvertisementSideID")%>" target="_blank"><img border="0"
> alt="<%=objRst.Fields("ImgAlt")%>"
> src="../uploads/img/advertisment_side/<%=objRst.Fields("ImgSrc")%
> >"></a><br>
> <%
> Repeat101__index=Repeat101__index+1
>
> objRst.MoveNext()
> Wend
> %>
> <%
> objRst.Close
> Set objRst = Nothing
>
> objConn.Close
> Set objConn = Nothing
> %>
>
>
Message #5 by "e n z o" <enzaux@g...> on Wed, 20 Feb 2002 01:02:16 +0800
|
|
I agree with alfredo, it means that your recordset is either getting no data
at all or the record that your looking has been deleted
Enzo :)
----- Original Message -----
From: "Alfredo Yong" <alfredo_yong_linux@h...>
Newsgroups: asp_web_howto
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Wednesday, February 20, 2002 12:32 AM
Subject: [asp_web_howto] RE: Either BOF or EOF is True, or the current
record has been deleted.
> You must test if rs.EOF before html generation.
>
> rs.open ...
> If Not rs.EOF THen
> Response.Write "<p>" & rs("myField")
> ...
> End If
> --
>
>
>
> =================================================================
> Alfredo_Yong@h...
> Freelance Developer - Web systems
> Expertise in ASP, DHTML, CSS, jscript, php, SQL & etc.
> Available to contract.
>
> Evan <raisy@w...> escribió en el mensaje de noticias
> 147872@a..._web_howto...
> >
> > Hello everybody,
> >
> > I'm still a bit of a newbee here with ASP, but I'm learning :o)
> > One lil question I have is WHERE to put the following code in my script
> > so I will not get error messages saying
> >
> > *************************************
> > THe wellknown error :o| (for me at least)
> > *************************************
> > Error Type:
> > ADODB.Recordset (0x800A0BCD)
> > Either BOF or EOF is True, or the current record has been deleted.
> > Requested operation requires a current record.:
> >
> > ----------------------------
> > I have been trying different things, but can't have the page to load
> > WITHOUT getting that error when there is no recordset available (this
> > might occur once in a while.....)
> > Thank you so much for all of your help!
> >
> > Evan
> > ----------------------------
> >
> >
> >
> >
> > *************************************
> > Code
> > *************************************
> > <% If Not WHATRECORDSET????.EOF Or Not WHATRECORDSET????.BOF Then %>
> > <% End If %>
> >
> >
> > *************************************
> > My Advertisement Rotation Script
> > *************************************
> > <%
> > Dim objConn
> > Dim objRst
> > Dim strSQL
> > Dim strConnection
> > Dim str
> > Dim str1
> > Dim cnt
> > Dim cnt1
> > Dim rndMax
> > Dim RndNumber
> >
> > strConnection="Provider=Microsoft.Jet.OLEDB.4.0;Data
> > Source=D:\WWWRoot\myserver\Database\dd.mdb"
> > strSQL = "SELECT AdvertisementSideID, Show, SiteCategoryID FROM
> > tblAdvertisementSide WHERE Show = 'Y' AND SiteCategoryID = 10"
> >
> > set objConn = Server.CreateObject("ADODB.Connection")
> > Set objRst = Server.CreateObject("ADODB.Recordset")
> > objConn.Open strConnection
> > set objRst.ActiveConnection = objConn
> > objRst.LockType = adLockOptimistic
> > objRst.CursorType = adOpenKeySet
> > objRst.Open strSQL
> >
> > objRst.MoveLast
> > cnt = objRst.RecordCount
> > cnt1 = cnt
> > rndMax = cnt
> >
> > If CInt(3) < cnt Then
> > cnt1 = CInt(3)
> > End If
> >
> > str = ","
> > str1 = ","
> >
> > Do Until cnt1 = 0
> > Randomize
> > RndNumber = Int(Rnd * rndMax)
> >
> > If (InStr(1, str1, "," & RndNumber & "," ) = 0) Then
> > str1 = str1 & RndNumber & ","
> > cnt1 = cnt1 - 1
> > objRst.MoveFirst
> > objRst.Move RndNumber
> > str = str & objRst("AdvertisementSideID") & ","
> > End If
> >
> > Loop
> >
> > objRst.Close
> > Set objRst = Nothing
> >
> > sql = "SELECT * FROM tblAdvertisementSide WHERE (((InStr(1,'" & str &
"',
> > (',' & [AdvertisementSideID] & ',')))<>0)) ORDER BY Rnd(IsNull
> > ([AdvertisementSideID])*0+1)"
> > Set objRst = Server.CreateObject("ADODB.Recordset")
> > set objRst.ActiveConnection = objConn
> > objRst.LockType = adLockOptimistic
> > objRst.CursorType = adOpenStatic
> > objRst.Open sql
> > %>
> > <%
> > Dim Repeat101__numRows
> > Repeat101__numRows = -1
> > Dim Repeat101__index
> > Repeat101__index = 0
> > objRst_numRows = objRst_numRows + Repeat101__numRows
> > %>
> > <%
> > While ((Repeat101__numRows <> 0) AND (NOT objRst.EOF))
> > %>
> > </p>
> > <a href="../redirect_side.asp?AdvertisementSideID=<%
> > =objRst.Fields("AdvertisementSideID")%>" target="_blank"><img border="0"
> > alt="<%=objRst.Fields("ImgAlt")%>"
> > src="../uploads/img/advertisment_side/<%=objRst.Fields("ImgSrc")%
> > >"></a><br>
> > <%
> > Repeat101__index=Repeat101__index+1
> >
> > objRst.MoveNext()
> > Wend
> > %>
> > <%
> > objRst.Close
> > Set objRst = Nothing
> >
> > objConn.Close
> > Set objConn = Nothing
> > %>
> >
> >
>
>
>
$subst('Email.Unsub').
>
Message #6 by "Evan / Raisor -> You know ;o)" <raisy@w...> on Tue, 19 Feb 2002 17:56:53 +0100
|
|
Thank you very much all.....I'm looking into it all :o)))
Evan
At 01:02 AM 2/20/2002 +0800, you wrote:
>I agree with alfredo, it means that your recordset is either getting no
data
>at all or the record that your looking has been deleted
>
>Enzo :)
>----- Original Message -----
>From: "Alfredo Yong" <alfredo_yong_linux@h...>
>Newsgroups: asp_web_howto
>To: "ASP Web HowTo" <asp_web_howto@p...>
>Sent: Wednesday, February 20, 2002 12:32 AM
>Subject: [asp_web_howto] RE: Either BOF or EOF is True, or the current
>record has been deleted.
>
>
> > You must test if rs.EOF before html generation.
> >
> > rs.open ...
> > If Not rs.EOF THen
> > Response.Write "<p>" & rs("myField")
> > ...
> > End If
> > --
> >
> >
> >
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > Alfredo_Yong@h...
> > Freelance Developer - Web systems
> > Expertise in ASP, DHTML, CSS, jscript, php, SQL & etc.
> > Available to contract.
> >
> > Evan <raisy@w...> escribi=F3 en el mensaje de noticias
> > 147872@a..._web_howto...
> > >
> > > Hello everybody,
> > >
> > > I'm still a bit of a newbee here with ASP, but I'm learning :o)
> > > One lil question I have is WHERE to put the following code in my
script
> > > so I will not get error messages saying
> > >
> > > *************************************
> > > THe wellknown error :o| (for me at least)
> > > *************************************
> > > Error Type:
> > > ADODB.Recordset (0x800A0BCD)
> > > Either BOF or EOF is True, or the current record has been deleted.
> > > Requested operation requires a current record.:
> > >
> > > ----------------------------
> > > I have been trying different things, but can't have the page to load
> > > WITHOUT getting that error when there is no recordset available (this
> > > might occur once in a while.....)
> > > Thank you so much for all of your help!
> > >
> > > Evan
> > > ----------------------------
> > >
> > >
> > >
> > >
> > > *************************************
> > > Code
> > > *************************************
> > > <% If Not WHATRECORDSET????.EOF Or Not WHATRECORDSET????.BOF Then %>
> > > <% End If %>
> > >
> > >
> > > *************************************
> > > My Advertisement Rotation Script
> > > *************************************
> > > <%
> > > Dim objConn
> > > Dim objRst
> > > Dim strSQL
> > > Dim strConnection
> > > Dim str
> > > Dim str1
> > > Dim cnt
> > > Dim cnt1
> > > Dim rndMax
> > > Dim RndNumber
> > >
> > > strConnection=3D"Provider=3DMicrosoft.Jet.OLEDB.4.0;Data
> > > Source=3DD:\WWWRoot\myserver\Database\dd.mdb"
> > > strSQL =3D "SELECT AdvertisementSideID, Show, SiteCategoryID FROM
> > > tblAdvertisementSide WHERE Show =3D 'Y' AND SiteCategoryID =3D 10"
> > >
> > > set objConn =3D Server.CreateObject("ADODB.Connection")
> > > Set objRst =3D Server.CreateObject("ADODB.Recordset")
> > > objConn.Open strConnection
> > > set objRst.ActiveConnection =3D objConn
> > > objRst.LockType =3D adLockOptimistic
> > > objRst.CursorType =3D adOpenKeySet
> > > objRst.Open strSQL
> > >
> > > objRst.MoveLast
> > > cnt =3D objRst.RecordCount
> > > cnt1 =3D cnt
> > > rndMax =3D cnt
> > >
> > > If CInt(3) < cnt Then
> > > cnt1 =3D CInt(3)
> > > End If
> > >
> > > str =3D ","
> > > str1 =3D ","
> > >
> > > Do Until cnt1 =3D 0
> > > Randomize
> > > RndNumber =3D Int(Rnd * rndMax)
> > >
> > > If (InStr(1, str1, "," & RndNumber & "," ) =3D 0) Then
> > > str1 =3D str1 & RndNumber & ","
> > > cnt1 =3D cnt1 - 1
> > > objRst.MoveFirst
> > > objRst.Move RndNumber
> > > str =3D str & objRst("AdvertisementSideID") & ","
> > > End If
> > >
> > > Loop
> > >
> > > objRst.Close
> > > Set objRst =3D Nothing
> > >
> > > sql =3D "SELECT * FROM tblAdvertisementSide WHERE (((InStr(1,'" & str
&
>"',
> > > (',' & [AdvertisementSideID] & ',')))<>0)) ORDER BY Rnd(IsNull
> > > ([AdvertisementSideID])*0+1)"
> > > Set objRst =3D Server.CreateObject("ADODB.Recordset")
> > > set objRst.ActiveConnection =3D objConn
> > > objRst.LockType =3D adLockOptimistic
> > > objRst.CursorType =3D adOpenStatic
> > > objRst.Open sql
> > > %>
> > > <%
> > > Dim Repeat101__numRows
> > > Repeat101__numRows =3D -1
> > > Dim Repeat101__index
> > > Repeat101__index =3D 0
> > > objRst_numRows =3D objRst_numRows + Repeat101__numRows
> > > %>
> > > <%
> > > While ((Repeat101__numRows <> 0) AND (NOT objRst.EOF))
> > > %>
> > > </p>
> > > <a href=3D"../redirect_side.asp?AdvertisementSideID=3D<%
> > > =3DobjRst.Fields("AdvertisementSideID")%>" target=3D"_blank"><img
border=3D"0"
> > > alt=3D"<%=3DobjRst.Fields("ImgAlt")%>"
> > > src=3D"../uploads/img/advertisment_side/<%=3DobjRst.Fields("ImgSrc")%
> > > >"></a><br>
> > > <%
> > > Repeat101__index=3DRepeat101__index+1
> > >
> > > objRst.MoveNext()
> > > Wend
> > > %>
> > > <%
> > > objRst.Close
> > > Set objRst =3D Nothing
> > >
> > > objConn.Close
> > > Set objConn =3D Nothing
> > > %>
> > >
> > >
> >
> >
> >
>$subst('Email.Unsub').
> >
>
>
$subst('Email.Unsub').
|
|
 |