Re: sometimes endless loop, sometimes not
- From: "Daniel Crichton" <msnews@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 16 Aug 2005 17:29:03 +0100
MiniMike wrote on Tue, 16 Aug 2005 06:44:01 -0700:
> Thank you very much! I'm not so keen on Access too, but it's for a little
> website i created for our basketball team. It's on a free, shared hosting,
> asp web server. I couldn't afford a hosting with SQL server :)
That fair enough. However, even though I'm a SQL DBA (well, working on it
:P) and we use SQL Server at work, my personal web hosting uses MySQL which
is free. There are a few differences to programming against Access, but many
benefits.
Dan
> "Daniel Crichton" wrote:
>
>> MiniMike wrote on Tue, 16 Aug 2005 01:53:07 -0700:
>>
>>> I am sure that RS.MoveNext is inside the loop.
>>> But i was using On Error Resume Next, and did not check the error after
>>> showing a record. So this was pretty helpful for me. I'll change it, and
>>> check it again.
>>> Thanks !
>>> But it still confuses me a little bit; why would there be an error , and
>>> sometimes not? Nothing (not the page, not the data, ...) has changed.
>>> Would that be an access-bug or something?
>>
>> To find out what the error is, add something to spit it out on the page
>> just after the loop, or remove the On Error Resume Next, eg.
>>
>> If Err.Number <> 0 Then
>> Response.Write "Error occured: " & Err.Number & " " & Err.Description
>> End If
>>
>> That way you can see what the error is when it happens, and start working
>> to resolve it. Without knowing the error number there's not much you can
>> do. It could be down to record locking for instance - Jet is not a
>> reliable multiuser database, and if you've got too many "users" accessing
>> it at the same time it's possible one will prevent another from reading
>> the next record - and then you're stuck until that lock is resolved. To
>> avoid this sort of thing you can try some of the following:
>>
>> Ensure all recordsets are forwardonly readonly - this is normally the
>> default in ADO
>>
>> Keep any editing of recordsets as quick as possible - don't use
>> Pessimistic locking if you can help it, and don't start editing a record
>> and then have your code do some long calculations before finishing
>> changes and issuing the .Update, as the record will be locked the whole
>> time.
>>
>> Make sure you're running Jet 4.0 as it has row level locking rather
>> than page level, and ensure that row level locking isn't being disabled.
>>
>> For high traffic sites I'd recommend you move away from Access - I used
>> to use it on my web server and moved to SQL Server when I started getting
>> frequent timeouts and record locking issues, and poor performance when
>> searching for records. Haven't looked back since :)
>>
>> Dan
>>
>>> "Daniel Crichton" wrote:
>>>
>>>> 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
- Re: sometimes endless loop, sometimes not
- From: Daniel Crichton
- Re: sometimes endless loop, sometimes not
- From: MiniMike
- Re: sometimes endless loop, sometimes not
- From: Daniel Crichton
- Re: sometimes endless loop, sometimes not
- From: MiniMike
- sometimes endless loop, sometimes not
- Prev by Date: Re: sometimes endless loop, sometimes not
- Next by Date: can not connect to the mdb database
- Previous by thread: Re: sometimes endless loop, sometimes not
- Next by thread: Re: sometimes endless loop, sometimes not
- Index(es):
Relevant Pages
|