Re: sometimes endless loop, sometimes not
- From: "Daniel Crichton" <msnews@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 16 Aug 2005 09:36:03 +0100
MiniMike wrote on Tue, 16 Aug 2005 00:15:02 -0700:
> I'm having this very weird problem on my website. I'm using ASP, and an
> Access 2003 database.
>
> The problem is this:
> When i surf to my page, there's usually no problem.
> I have this select statement :
> SQL = "Select * " _
> & "from tblTable " _
> & "order by intID desc"
> Set RS = Conn.Execute(SQL)
> If not RS.Eof Then
> Do while not RS.Eof
> 'show this record on the site
> Loop
> End if
>
> My recordset is loaded, and i show the records on the site. There are only
> 4 records for now.
>
> But, sometimes, when i surf to my page (just the same page, just the same
> query, only other time), my page goes into an endless loop.
>
> Anyone with any ideas on this? The strange thing is, though it's the same
> page, i reacts different on different times.
Are you sure you've got
RS.MoveNext
inside that Do ... Loop? If so, then the only other problem could be that
you've got an error occuring, you've got On Error Resume Next in your
script, and you're not checking for an error before the last record is moved
past - in which case RS.Eof is still false, but every attempt to move to the
next record fails. Try something like this:
On Error Resume Next
SQL = "Select * " _
& "from tblTable " _
& "order by intID desc"
Set RS = Conn.Execute(SQL)
If not RS.Eof And Err.Number = 0 Then
Do while not RS.Eof and Err.Number = 0
'show this record on the site
RS.MoveNext
Loop
End if
RS.Close
Set RS = Nothing
Dan
.
- Follow-Ups:
- Re: sometimes endless loop, sometimes not
- From: MiniMike
- Re: sometimes endless loop, sometimes not
- References:
- sometimes endless loop, sometimes not
- From: MiniMike
- sometimes endless loop, sometimes not
- Prev by Date: sometimes endless loop, sometimes not
- Next by Date: Re: sometimes endless loop, sometimes not
- Previous by thread: sometimes endless loop, sometimes not
- Next by thread: Re: sometimes endless loop, sometimes not
- Index(es):
Relevant Pages
|
|