Re: sometimes endless loop, sometimes not



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


.



Relevant Pages

  • Re: Non-rectangular 3D plot
    ... loop' properly to get x and y vectors and the z matrix. ... Roger Stafford wrote: ... rectangular space. ... There is an example of a sphere generated by 'surf' in the function reference ...
    (comp.soft-sys.matlab)
  • Re: sometimes endless loop, sometimes not
    ... after the loop, or remove the On Error Resume Next, eg. ... Make sure you're running Jet 4.0 as it has row level locking rather than ... Dan ... >>> When i surf to my page, ...
    (microsoft.public.data.ado)
  • Re: sometimes endless loop, sometimes not
    ... I am sure that RS.MoveNext is inside the loop. ... showing a record. ... >> Access 2003 database. ... >> When i surf to my page, ...
    (microsoft.public.data.ado)
  • making a 3D figure out of coordinates
    ... is it possible to make a loop to find the close dots so I can make one solid piece? ... I also thought of mesh or surf but you need a grid for that and they're not on a grid. ...
    (comp.soft-sys.matlab)
  • Re: RunCommand acCmdRecordsGoToNext
    ... Another thing that may come in handy if that doesn't is to loop through the ... The database I am utilizing this ... increasing intRecordCount on each loop. ... Dim strPassword As String ...
    (microsoft.public.access.forms)