I have a loop on page to update an access database that takes 15-20 seconds to complete. I only run it once a month at most but I noticed that every time I run it the web site (IIS 6) simply stops serving pages.
After the loop ends, pages begin opening again.
Here’s my code:
For each Email in Emails if Trim(Email) <> '' then ' execute the update Set MM_editCmd = Server.CreateObject('ADODB.Command') MM_editCmd.ActiveConnection = MM_Customers_STRING MM_editCmd.CommandText = 'UPDATE Customers SET MailingListUpdates=False WHERE Email='' & Trim(Email) & ''' MM_editCmd.Execute MM_editCmd.ActiveConnection.Close Response.Write 'Email address ' & Email & ' successfully removed from the mailing list.<br>' end if Next
Is there anything I can do to avoid this?
Emails on the last update was around 700 records.
You are probably using up all the available connections in the connection pool. Try this instead:
Also as a more long term thing try upgrading to SQL Server Express