|
 |
asp_databases thread: timeout on asp page
Message #1 by "Adam H-W" <adam_hw@k...> on Thu, 14 Nov 2002 15:52:23
|
|
Hi
I'm having trouble debugging my asp page because it times out. I don't
want to increase the timeout on iis or Server.SciptTimeout because I know
that there's an error somewhere ( it shouldn't take nearly this amount of
time to process!).
What I'm doing on the page is: I have 2 text boxes, one where you key in
the start date and one where you key in the end date - you hit submit and
it pulls all the records between the dates. My code is below....it's a bit
long so if you don't want to go through it, then I don't blame you;
however, it would be much obliged if anyone could help!
thanks
Adam
<%
response.buffer = true
on error resume next
if request("to") <> "" AND request("from") <> "" then
set con = server.createobject("ADODB.Connection")
con.open Application("thezone_ConnectionString")
thefromDay = Day(request("from"))
thefromMonth = MonthName(Month(request("from")), True)
thefromYear = Year(request("from"))
thefromDate = thefromDay & "-" & thefromMonth & "-" & thefromYear
thetoDay = Day(request("to"))
thetoMonth = MonthName(Month(request("to")), True)
thetoYear = Year(request("to"))
thetoDate = thetoDay & "-" & thetoMonth & "-" & thetoYear
SQLGetOrders = "SELECT SUM(t.Price * t.Quantity)
AS 'Turnover Per Period' FROM TransactionLogItem t, TransactionLog tl
WHERE (t.CloseOrderDate BETWEEN '"& thefromDate &"' AND '"& thetoDate &"')
AND t.TransactionID LIKE 'PZSK_%' AND t.TransactionID = tl.TransactionID"
set rsOrders = con.execute(SQLGetOrders)
end if
%>
<html>
<head>
<title>Product Sales Per Period</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" bgcolor="#C0C0C0">
<p align="center"><b><font size="2" face="Arial">PRODUCT SALES PER
PERIOD</font></b>
</td>
</tr>
</table>
<hr noshade color="#C0C0C0">
<form name="form1" method="post" action="">
<table border="1" cellpadding="2" cellspacing="0" bgcolor="#C0C0C0"
bordercolorlight="#000000" bordercolordark="#FFFFFF" align="center">
<tr>
<td bgcolor="#000000" align="center"><font color="#FFFFFF" size="2"
face="Arial">Period
From </font></td>
<td> <font size="1" face="Arial, Helvetica, sans-serif">
<%if request("from") <> "" then%>
<input type="text" name="from" value="<%=request("from")%>">
<%else%>
<%
theDay = Day(Date())
theMonth = MonthName(Month(Date()), True)
theYear = Year(Date())
theDate = theDay & "-" & theMonth & "-" & theYear
%>
<input type="text" name="from" value="<%=theDate%>">
<%end if%>
(eg. 16/10/2002 07:20:00) </font></td>
</tr>
<tr>
<td align="center" bgcolor="#000000"><font size="2" face="Arial"
color="#FFFFFF">Period
To</font></td>
<td> <font size="1" face="Arial, Helvetica, sans-serif">
<input type="text" name="to" value="<%=request("to")%>">
(eg. 16/12/2002 07:20:00) </font></td>
</tr>
<tr>
<td align="center" bgcolor="#000000" colspan="2">
<p> <font size="2">
<input type="submit" name="Submit" value=" Show ">
</font></p>
</td>
</tr>
</table>
</form>
<%if request("to") <> "" AND request("from") <> "" then%>
<%if not rsCloseOrderDate.EOF then%>
<%
SQLGetAmount ="SELECT SUM(t.Price * t.Quantity) AS 'TotalAmount'
FROM TransactionLogItem t, TransactionLog tl WHERE t.CloseOrderDate
BETWEEN '"& CDate(request("from")) &"' AND '"& CDate(request("to")) &"'
AND t.TransactionID LIKE 'PZSK_%' AND t.TransactionID = tl.TransactionID"
set rsAmount = con.execute(SQLGetAmount)
%>
<font face="Arial, Helvetica, sans-serif" size="2"><center>
Total for selected period - <b><%="£" & FormatNumber(rsAmount(0))%></b>
</center></font>
<br>
<table border="1" cellpadding="2" cellspacing="0" bgcolor="#C0C0C0"
bordercolorlight="#000000" bordercolordark="#FFFFFF" align="center">
<tr>
<td bgcolor="#000000"><font size="1" face="Arial"
color="#FFFFFF">Product
</font></td>
<td bgcolor="#000000"><font size="1" face="Arial"
color="#FFFFFF">Product ID
</font></td>
<td bgcolor="#000000"><font size="1" face="Arial"
color="#FFFFFF">Quantity Ordered</font></td>
</tr>
<%
do until rsTransactionLog.EOF
theOrderDay = Day(rsTransactionLog("TransactionID"))
theOrderMonth = MonthName(Month(rsTransactionLog("Closed")), True)
theOrderYear = Year(rsTransactionLog("CloseOrderDate"))
theOrderDate = theOrderDay & "-" & theOrderMonth & "-" &
theOrderYear
%>
<tr>
<td><font face="Arial, Helvetica, sans-serif" size="1"><%=theOrderDate%
></font></td>
<td><font face="Arial, Helvetica, sans-serif" size="1"><%
=rsTransactionLog("TransactionID")%></font></td>
<td><font face="Arial, Helvetica, sans-serif" size="1"><%
=rsTransactionLog("Closed")%></font></td>
<td><font size="1" face="Arial, Helvetica, sans-serif"><%
=rsTransactionLog("CloseOrderDate")%></font></td>
<td><font face="Arial, Helvetica, sans-serif" size="1"><%="£" &
FormatNumber(rsTransactionLog("TotalAmount"))%></font></td>
</tr>
<%
rsTransactionLog.Movenext
loop
%>
</table>
<%else%>
<font face="Arial, Helvetica, sans-serif" size="2"><center>No orders
falling within the
selected period...</center></font><%end if%>
<%end if%>
</body>
</html>
<%
if request("to") <> "" AND request("from") <> "" then
con.close
set con = Nothing
set rsCloseOrderDate = Nothing
set rsAmount = Nothing
end if
%>
Message #2 by "Craig Flannigan" <ckf@k...> on Thu, 14 Nov 2002 15:46:17 -0000
|
|
Take out your "On Error Resume Next line"
Should show you the errors that might be making the page timeout.
-----Original Message-----
From: Adam H-W [mailto:adam_hw@k...]
Sent: 14 November 2002 15:52
To: ASP Databases
Subject: [asp_databases] timeout on asp page
Hi
I'm having trouble debugging my asp page because it times out. I don't
want to increase the timeout on iis or Server.SciptTimeout because I know
that there's an error somewhere ( it shouldn't take nearly this amount of
time to process!).
What I'm doing on the page is: I have 2 text boxes, one where you key in
the start date and one where you key in the end date - you hit submit and
it pulls all the records between the dates. My code is below....it's a bit
long so if you don't want to go through it, then I don't blame you;
however, it would be much obliged if anyone could help!
thanks
Adam
<%
response.buffer = true
on error resume next
if request("to") <> "" AND request("from") <> "" then
set con = server.createobject("ADODB.Connection")
con.open Application("thezone_ConnectionString")
thefromDay = Day(request("from"))
thefromMonth = MonthName(Month(request("from")), True)
thefromYear = Year(request("from"))
thefromDate = thefromDay & "-" & thefromMonth & "-" & thefromYear
thetoDay = Day(request("to"))
thetoMonth = MonthName(Month(request("to")), True)
thetoYear = Year(request("to"))
thetoDate = thetoDay & "-" & thetoMonth & "-" & thetoYear
SQLGetOrders = "SELECT SUM(t.Price * t.Quantity)
AS 'Turnover Per Period' FROM TransactionLogItem t, TransactionLog tl
WHERE (t.CloseOrderDate BETWEEN '"& thefromDate &"' AND '"& thetoDate &"')
AND t.TransactionID LIKE 'PZSK_%' AND t.TransactionID = tl.TransactionID"
set rsOrders = con.execute(SQLGetOrders)
end if
%>
<html>
<head>
<title>Product Sales Per Period</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF">
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" bgcolor="#C0C0C0">
<p align="center"><b><font size="2" face="Arial">PRODUCT SALES PER
PERIOD</font></b>
</td>
</tr>
</table>
<hr noshade color="#C0C0C0">
<form name="form1" method="post" action="">
<table border="1" cellpadding="2" cellspacing="0" bgcolor="#C0C0C0"
bordercolorlight="#000000" bordercolordark="#FFFFFF" align="center">
<tr>
<td bgcolor="#000000" align="center"><font color="#FFFFFF" size="2"
face="Arial">Period
From </font></td>
<td> <font size="1" face="Arial, Helvetica, sans-serif">
<%if request("from") <> "" then%>
<input type="text" name="from" value="<%=request("from")%>">
<%else%>
<%
theDay = Day(Date())
theMonth = MonthName(Month(Date()), True)
theYear = Year(Date())
theDate = theDay & "-" & theMonth & "-" & theYear
%>
<input type="text" name="from" value="<%=theDate%>">
<%end if%>
(eg. 16/10/2002 07:20:00) </font></td>
</tr>
<tr>
<td align="center" bgcolor="#000000"><font size="2" face="Arial"
color="#FFFFFF">Period
To</font></td>
<td> <font size="1" face="Arial, Helvetica, sans-serif">
<input type="text" name="to" value="<%=request("to")%>">
(eg. 16/12/2002 07:20:00) </font></td>
</tr>
<tr>
<td align="center" bgcolor="#000000" colspan="2">
<p> <font size="2">
<input type="submit" name="Submit" value=" Show ">
</font></p>
</td>
</tr>
</table>
</form>
<%if request("to") <> "" AND request("from") <> "" then%>
<%if not rsCloseOrderDate.EOF then%>
<%
SQLGetAmount ="SELECT SUM(t.Price * t.Quantity) AS 'TotalAmount'
FROM TransactionLogItem t, TransactionLog tl WHERE t.CloseOrderDate
BETWEEN '"& CDate(request("from")) &"' AND '"& CDate(request("to")) &"'
AND t.TransactionID LIKE 'PZSK_%' AND t.TransactionID = tl.TransactionID"
set rsAmount = con.execute(SQLGetAmount)
%>
<font face="Arial, Helvetica, sans-serif" size="2"><center>
Total for selected period - <b><%="£" & FormatNumber(rsAmount(0))%></b>
</center></font>
<br>
<table border="1" cellpadding="2" cellspacing="0" bgcolor="#C0C0C0"
bordercolorlight="#000000" bordercolordark="#FFFFFF" align="center">
<tr>
<td bgcolor="#000000"><font size="1" face="Arial"
color="#FFFFFF">Product
</font></td>
<td bgcolor="#000000"><font size="1" face="Arial"
color="#FFFFFF">Product ID
</font></td>
<td bgcolor="#000000"><font size="1" face="Arial"
color="#FFFFFF">Quantity Ordered</font></td>
</tr>
<%
do until rsTransactionLog.EOF
theOrderDay = Day(rsTransactionLog("TransactionID"))
theOrderMonth = MonthName(Month(rsTransactionLog("Closed")), True)
theOrderYear = Year(rsTransactionLog("CloseOrderDate"))
theOrderDate = theOrderDay & "-" & theOrderMonth & "-" &
theOrderYear
%>
<tr>
<td><font face="Arial, Helvetica, sans-serif" size="1"><%=theOrderDate%
></font></td>
<td><font face="Arial, Helvetica, sans-serif" size="1"><%
=rsTransactionLog("TransactionID")%></font></td>
<td><font face="Arial, Helvetica, sans-serif" size="1"><%
=rsTransactionLog("Closed")%></font></td>
<td><font size="1" face="Arial, Helvetica, sans-serif"><%
=rsTransactionLog("CloseOrderDate")%></font></td>
<td><font face="Arial, Helvetica, sans-serif" size="1"><%="£" &
FormatNumber(rsTransactionLog("TotalAmount"))%></font></td>
</tr>
<%
rsTransactionLog.Movenext
loop
%>
</table>
<%else%>
<font face="Arial, Helvetica, sans-serif" size="2"><center>No orders
falling within the
selected period...</center></font><%end if%>
<%end if%>
</body>
</html>
<%
if request("to") <> "" AND request("from") <> "" then
con.close
set con = Nothing
set rsCloseOrderDate = Nothing
set rsAmount = Nothing
end if
%>
_____________________________________________________________________
Please contact I.T. Support if you have received this email in error.
This e-mail has been scanned for all viruses by Star Internet.
_____________________________________________________________________
_____________________________________________________________________
Kingfield Heath Ltd. Email Disclaimer
Confidentiality : This email and its attachments are intended for the
above-named only and may be confidential. If they have come to you in
error you must take no action based on them, nor must you copy or
show them to anyone; please reply to this email and highlight the
error.
Security Warning : Please note that this email has been created in
the knowledge that the internet is not a 100% secure communications
medium. We advise that you understand and observe this lack of
security when emailing us.
Viruses : Although we have taken steps to ensure that this email and
attachments are free from any virus, we advise that, in keeping with
good computing practice, the recipient should ensure they are
actually virus free.
_____________________________________________________________________
|
|
 |