Re: sometimes endless loop, sometimes not

Tech-Archive recommends: Fix windows errors by optimizing your registry



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
>>>>


.



Relevant Pages

  • Re: sometimes endless loop, sometimes not
    ... Would you tell me where you host your personal website? ... I couldn't afford a hosting with SQL server:) ... and ensure that row level locking isn't being disabled. ... >>> to use it on my web server and moved to SQL Server when I started getting ...
    (microsoft.public.data.ado)
  • RE: Problems with WebParts
    ... to a database called aspnetdb. ... > The connection string specifies a local SQL Server Express instance using a ... > server account must have read and write access to the applications directory. ... > This is necessary because the web server account will automatically create ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: .NET Hosting Solutions
    ... If you want a SQL Server database with your hosting, ... I thought of> trying to setup IIS 6.0 on a Windows 2003 Server and> installing SQL Server 2000. ... > A good alternative seems to be using a hosting service. ... > Having been burnt in the past when choosing a MySQL host> only to learn too late that many functions for MySQL> simply didn't exist with the service, I need advice on> choosing the correct host for my training objective. ...
    (microsoft.public.cert.exam.mcsd)
  • Re: Remote development advice
    ... We are using IIS as the web server. ... The IIS and SQL Server is setup in his ... I want to be able to access the pages that my friend has done remotely ... Then whichever web site he has configured as the default site on IIS should appear, assuming the web server was configured correctly. ...
    (microsoft.public.dotnet.general)
  • Re: sometimes endless loop, sometimes not
    ... > after the loop, or remove the On Error Resume Next, eg. ... and ensure that row level locking isn't being disabled. ... > use it on my web server and moved to SQL Server when I started getting ... >>> Dan ...
    (microsoft.public.data.ado)