Script timeout displaying search results.
I've been given a website to fix and don't really have any ASP knowledge. There is a problem with a search that keeps having script time outs (script timeout is 2 minutes which should surely be ample?). By setting response.writes at various points i have managed to find where the app times out and it's at the following section:
Code:
</tr><% Do While Not objRs.EOF
iNetPrice = objRs.Fields(11).Value
iVATAmount = objRs.Fields(12).Value
iTotal = objRs.Fields(13).Value
iVATTotal = iVATTotal + iVATAmount
iNetTotal = iNetTotal + iNetPrice
iTotalTotal = iTotalTotal + iTotal%>
<tr <%=AlternateRow(i)%>>
<td class="Padded" align="center"><a href="<%=PageURL("PurchaseReq.asp", Array("PurchaseReqID", objRs.Fields(0).Value))%>"><%=objRs.Fields(1).Value%></a></td>
<td class="Padded" align="center"><% If Not IsNull(objRs.Fields(2).Value) Then Response.Write DateValue(objRs.Fields(2).Value) & "<br>" & objRs.Fields(3).Value End If%></td>
<td class="Padded" align="center"><% If Not IsNull(objRs.Fields(4).Value) Then Response.Write DateValue(objRs.Fields(4).Value) & "<br>" & objRs.Fields(5).Value End If%></td>
<td class="Padded" align="center"><% If Not IsNull(objRs.Fields(6).Value) Then Response.Write DateValue(objRs.Fields(6).Value) End If%></td>
<td class="Padded" align="center"><% If Not IsNull(objRs.Fields(7).Value) Then Response.Write DateValue(objRs.Fields(7).Value) & "<br>" & objRs.Fields(8).Value End If%></td>
<td class="Padded"><%=Replace(Server.HTMLEncode("" & objRs.Fields(9).Value), vbCrLf, "<br>")%></td>
<td class="Padded"><% GetCostCentres objRs.Fields(10).Value%></td>
<td class="Padded" align="right"><%=PageMoney(iNetPrice)%></td>
<td class="Padded" align="right"><%=PageMoney(iVATAmount)%></td>
<td class="Padded" align="right"><%=PageMoney(iTotal)%></td>
<td class="Padded"><%=objRs.Fields(14).Value%></td>
</tr>
<tr>
<th colspan="11"><img border="0" src="../../../images/1px.gif"></th>
</tr><% objRs.MoveNext
i = i +1
Loop
When run on my own machine the database is searched and results displayed in seconds any idea's why it might be timing out on the server?
Re: Script timeout displaying search results.
the response.writes won't show up until the page is fully rendered aka all processing is done. Instead, write messages to a debug / log file. It's good practice, because once it goes live, you can keep these messages from the web user, while having the ability to see what's going on when and if something is going wrong.
Re: Script timeout displaying search results.
EDIT - Just Noticed this is from 2005! LOL :wave:
Re: Script timeout displaying search results.
hmmm interesting. I'm afraid I no longer remember the project.
I'm still rubbish at asp but thanks for the reply.