I have a very odd problem with one of my ASP scripts. It is a simple script, reads information from a database into a recordset and loops through the recordset, each time outputting HTML as a table row.
I'm having an issue where periodically it gets close to the end of its for each loop and it just stops without getting through all the recordsets. I know it is stopping because my resulting HTML only goes as far down as S or T in the recordset. The script is not crashing because underneath the for each loop I end the table and all that HTML is still present.
The odd thing is it is broken one refresh, then the next time I refresh it works - the data in the SQL Database is static and the ASP script is not changing. One load it can work, the next it can break.
I have no idea what is going on here so any advice is welcome!
One thing I tend to do is write the SQL to the page so I can see what's going on. Also, it might be helpful to write the count of the recordset to the page for debugging.
Try using something like this:
This routine will read the data directly into an array so you can examine it at leisure.
-- EDIT --
Just to add to this, the reason I've provided the code like this is as a function to extract all of the data in one go rather than loop through an open database connection.