Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > search within a search within a search - looking for better way...my script times out

Reply
Thread Tools

search within a search within a search - looking for better way...my script times out

 
 
Abby Lee
Guest
Posts: n/a
 
      07-29-2004
My code does what I want (works unless there is a lot of
volume...works for this month cause not a lot of items marked paid
yet...) but the page times out for last month because there is just
so many items. Is there a better way to do this?

my page gets all distinct Oganizations.
within each organization it gets each distinct Fund
within each fund it gets each distinct Program
then it lists each item that is paid for the month being
checked

So the end result is a list of each account that has been paid for
each Org/Fund/Program in order.

Oganization 000001
Fund 000001
Program 000001
Account 000001 MonthPd 0704 PdAmount 140.00
Account 000001 MonthPd 0704 PdAmount 370.66
Account 000001 MonthPd 0704 PdAmount 370.66

Oganization 000001
Fund 000001
Program 000001
Account 000002 MonthPd 0704 PdAmount 1.00
Account 000002 MonthPd 0704 PdAmount 880.60
..
..<snip> Went threw all accounts for Program One move to Program 2
..

Oganization 000001
Fund 000001
Program 000002
Account 000001 MonthPd 0704 PdAmount 1.00
Account 000001 MonthPd 0704 PdAmount 880.60
..
..<snip> Went threw all accounts/programs for fund 1 move on to fund 2
..

Oganization 000001
Fund 000002
Program 000001
Account 000001 MonthPd 0704 PdAmount 1.00
Account 000001 MonthPd 0704 PdAmount 880.60
..
..
..

My Code...sorry that I could not shorten it much more

++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++
[Next line is file telling where db is]
<!--#include file="include.asp"-->

<%

Dim connect, rs
Dim sSQL
Dim connect2, rs2
Dim sSQL2
Dim connect3, rs3
Dim sSQL3
Dim ThePD 'Date Paid for monthly reconciling
Dim TheYear 'Table in the database - each year is in different table
'Hard codeded for testing
ThePD = "0704"
'Hard coded for testing
TheYear = "AllExpenses2004"

Set connect = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateOBject("ADODB.Recordset")
connect.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sDataSource
connect.Open

Set connect2 = Server.CreateObject("ADODB.Connection")
Set rs2 = Server.CreateOBject("ADODB.Recordset")
connect2.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sDataSource
connect2.Open

Set connect3 = Server.CreateObject("ADODB.Connection")
Set rs3 = Server.CreateOBject("ADODB.Recordset")
connect3.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sDataSource
connect3.Open

Set connect4 = Server.CreateObject("ADODB.Connection")
Set rs4 = Server.CreateOBject("ADODB.Recordset")
connect4.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sDataSource
connect4.Open
%>

<html>
<head>
</head>
<body>
<table border="0">
<%
sSQL3 = "SELECT Distinct Organization" & _
" FROM " & TheYear & _
" WHERE MonthPD = '" & ThePD & "'" & _
" ORDER BY Organization"
set rs3 = Connect.Execute(sSQL3)
%>
<% Do until rs3.eof %>

<%
sSQL2 = "SELECT Distinct Fund" & _
" FROM " & TheYear & _
" WHERE MonthPD = '" & ThePD & "'" & _
" ORDER BY Fund"
set rs2 = Connect.Execute(sSQL2)
%>
<% Do until rs2.eof %>

<%
sSQL4 = "SELECT Distinct Fund, Organization, Program" & _
" FROM " & TheYear & _
" WHERE MonthPD = '" & ThePD & "'" & _
" ORDER BY Organization, Fund, Program"
set rs4 = Connect.Execute(sSQL4)
%>
<% Do until rs4.eof %>

<tr>
<td>Organization</td>
<td colspan="11"><%=rs4("Organization")%></td>
</tr>
<tr>
<td>Fund</td>
<td colspan="11"><%=rs4("Fund")%></td>
</tr>
<tr>
<td>Program</td>
<td colspan="11"><%=rs4("Program")%></td>
</tr>
<tr>
<td>Account</td>
<td>Month PD</td>
<td>PD Amount</td>
</tr>

<%
TheFund = rs4("Fund")
TheOrg = rs4("Organization")
TheProg = rs4("Program")

sSQL = "SELECT *" & _
" FROM " & TheYear & _
" WHERE MonthPD = '" & ThePD & "'" & _
" and Fund = '" & TheFund & "'"
set rs = Connect.Execute(sSQL)

Do until rs.eof
%>
<tr bgcolor="<%=sBackgroundColor%>">
<td class="text"><%=rs("Account")%></td>
<td class="text"><%=rs("MonthPd")%></td>
<td class="text"><%=rs("PdAmount")%></td>
</tr>

<% End If
rs.MoveNext
Loop %>
</tr>
<tr><tdnbsp;</td></tr>

<% rs4.MoveNext
Loop %>
<% rs2.MoveNext
Loop %>
<% rs3.MoveNext
Loop %>
</table>
<p>&nbsp;</p>
</body>
</html>
 
Reply With Quote
 
 
 
 
Jeff Cochran
Guest
Posts: n/a
 
      07-29-2004
On 29 Jul 2004 12:26:29 -0700, http://www.velocityreviews.com/forums/(E-Mail Removed) (Abby Lee) wrote:

>My code does what I want (works unless there is a lot of
>volume...works for this month cause not a lot of items marked paid
>yet...) but the page times out for last month because there is just
>so many items. Is there a better way to do this?


Hard to tell. How about a database type/version, and your query?
Table structure and sample data might help as well.

Jeff

>
>my page gets all distinct Oganizations.
> within each organization it gets each distinct Fund
> within each fund it gets each distinct Program
> then it lists each item that is paid for the month being
>checked
>
>So the end result is a list of each account that has been paid for
>each Org/Fund/Program in order.
>
>Oganization 000001
>Fund 000001
>Program 000001
>Account 000001 MonthPd 0704 PdAmount 140.00
>Account 000001 MonthPd 0704 PdAmount 370.66
>Account 000001 MonthPd 0704 PdAmount 370.66
>
>Oganization 000001
>Fund 000001
>Program 000001
>Account 000002 MonthPd 0704 PdAmount 1.00
>Account 000002 MonthPd 0704 PdAmount 880.60
>.
>.<snip> Went threw all accounts for Program One move to Program 2
>.
>
>Oganization 000001
>Fund 000001
>Program 000002
>Account 000001 MonthPd 0704 PdAmount 1.00
>Account 000001 MonthPd 0704 PdAmount 880.60
>.
>.<snip> Went threw all accounts/programs for fund 1 move on to fund 2
>.
>
>Oganization 000001
>Fund 000002
>Program 000001
>Account 000001 MonthPd 0704 PdAmount 1.00
>Account 000001 MonthPd 0704 PdAmount 880.60
>.
>.
>.
>
>My Code...sorry that I could not shorten it much more
>
>+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++
>[Next line is file telling where db is]
><!--#include file="include.asp"-->
>
><%
>
>Dim connect, rs
>Dim sSQL
>Dim connect2, rs2
>Dim sSQL2
>Dim connect3, rs3
>Dim sSQL3
>Dim ThePD 'Date Paid for monthly reconciling
>Dim TheYear 'Table in the database - each year is in different table
>'Hard codeded for testing
>ThePD = "0704"
>'Hard coded for testing
>TheYear = "AllExpenses2004"
>
>Set connect = Server.CreateObject("ADODB.Connection")
>Set rs = Server.CreateOBject("ADODB.Recordset")
>connect.ConnectionString = _
> "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "Data Source=" & sDataSource
>connect.Open
>
>Set connect2 = Server.CreateObject("ADODB.Connection")
>Set rs2 = Server.CreateOBject("ADODB.Recordset")
>connect2.ConnectionString = _
> "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "Data Source=" & sDataSource
>connect2.Open
>
>Set connect3 = Server.CreateObject("ADODB.Connection")
>Set rs3 = Server.CreateOBject("ADODB.Recordset")
>connect3.ConnectionString = _
> "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "Data Source=" & sDataSource
>connect3.Open
>
>Set connect4 = Server.CreateObject("ADODB.Connection")
>Set rs4 = Server.CreateOBject("ADODB.Recordset")
>connect4.ConnectionString = _
> "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> "Data Source=" & sDataSource
>connect4.Open
>%>
>
><html>
><head>
></head>
><body>
><table border="0">
><%
> sSQL3 = "SELECT Distinct Organization" & _
> " FROM " & TheYear & _
> " WHERE MonthPD = '" & ThePD & "'" & _
> " ORDER BY Organization"
> set rs3 = Connect.Execute(sSQL3)
>%>
><% Do until rs3.eof %>
>
><%
> sSQL2 = "SELECT Distinct Fund" & _
> " FROM " & TheYear & _
> " WHERE MonthPD = '" & ThePD & "'" & _
> " ORDER BY Fund"
> set rs2 = Connect.Execute(sSQL2)
>%>
><% Do until rs2.eof %>
>
><%
> sSQL4 = "SELECT Distinct Fund, Organization, Program" & _
> " FROM " & TheYear & _
> " WHERE MonthPD = '" & ThePD & "'" & _
> " ORDER BY Organization, Fund, Program"
> set rs4 = Connect.Execute(sSQL4)
>%>
><% Do until rs4.eof %>
>
><tr>
><td>Organization</td>
><td colspan="11"><%=rs4("Organization")%></td>
></tr>
><tr>
><td>Fund</td>
><td colspan="11"><%=rs4("Fund")%></td>
></tr>
><tr>
><td>Program</td>
><td colspan="11"><%=rs4("Program")%></td>
></tr>
><tr>
> <td>Account</td>
> <td>Month PD</td>
> <td>PD Amount</td>
></tr>
>
><%
>TheFund = rs4("Fund")
>TheOrg = rs4("Organization")
>TheProg = rs4("Program")
>
>sSQL = "SELECT *" & _
> " FROM " & TheYear & _
> " WHERE MonthPD = '" & ThePD & "'" & _
> " and Fund = '" & TheFund & "'"
> set rs = Connect.Execute(sSQL)
>
>Do until rs.eof
>%>
><tr bgcolor="<%=sBackgroundColor%>">
> <td class="text"><%=rs("Account")%></td>
> <td class="text"><%=rs("MonthPd")%></td>
> <td class="text"><%=rs("PdAmount")%></td>
></tr>
>
><% End If
>rs.MoveNext
>Loop %>
></tr>
><tr><tdnbsp;</td></tr>
>
><% rs4.MoveNext
>Loop %>
><% rs2.MoveNext
>Loop %>
><% rs3.MoveNext
>Loop %>
></table>
><p>&nbsp;</p>
></body>
></html>


 
Reply With Quote
 
 
 
 
Rune
Guest
Posts: n/a
 
      07-30-2004
I don't know about a better way, but if the problem is that your page times
out, then perhaps Response.Flush can help?

Try to replace this:

<% rs3.MoveNext
Loop %>

With this:

<%
Response.Flush
rs3.MoveNext
Loop
%>

If it still times out, try to put Response.Flush before rs2.MoveNext
instead.

Let me know if it helps.
(Err, not that I have other ideas if it doesn't help...)

Best regards,
Rune


 
Reply With Quote
 
Abby Lee
Guest
Posts: n/a
 
      07-30-2004
(E-Mail Removed) (Jeff Cochran) wrote in message news:<(E-Mail Removed)>...
> On 29 Jul 2004 12:26:29 -0700, (E-Mail Removed) (Abby Lee) wrote:
>
> >My code does what I want (works unless there is a lot of
> >volume...works for this month cause not a lot of items marked paid
> >yet...) but the page times out for last month because there is just
> >so many items. Is there a better way to do this?

>
> Hard to tell. How about a database type/version, and your query?
> Table structure and sample data might help as well.
>
> Jeff

Access 2000
13477 records
Fields: Chart=Number, Indexcode=Text, Fund=Text, Organization=Text,
Acount=Text, Program=Text, GrantIndex=Text, Activity=Text,
location=Text, Division=Text, Log=Text, Voucher=Text, Vendor=Text,
Item=Text, Vamount=Curreny, RecDate=Date/Time, Vdate=Date/Time
Discount=Currency, MonthPd=Text, PdAmount=Currency

I've included my queries between the body tags...the only place they
will work. Only thing I did not include was the file that tells my
query where to find my db ><!--#include file="include.asp"-->

My include.asp file:
<%
Dim sDataSoure
sDataSource = "f:\dbs\Access_Files\expense.mdb"
%>

<%
Function fncStrConv(str)
fncStrConv = Replace(Replace(str, "'", "''"), CHR(34), "&quote;")
End Function
%>


>
> >
> >my page gets all distinct Oganizations.
> > within each organization it gets each distinct Fund
> > within each fund it gets each distinct Program
> > then it lists each item that is paid for the month being
> >checked
> >
> >So the end result is a list of each account that has been paid for
> >each Org/Fund/Program in order.
> >
> >Oganization 000001
> >Fund 000001
> >Program 000001
> >Account 000001 MonthPd 0704 PdAmount 140.00
> >Account 000001 MonthPd 0704 PdAmount 370.66
> >Account 000001 MonthPd 0704 PdAmount 370.66
> >
> >Oganization 000001
> >Fund 000001
> >Program 000001
> >Account 000002 MonthPd 0704 PdAmount 1.00
> >Account 000002 MonthPd 0704 PdAmount 880.60
> >.
> >.<snip> Went threw all accounts for Program One move to Program 2
> >.
> >
> >Oganization 000001
> >Fund 000001
> >Program 000002
> >Account 000001 MonthPd 0704 PdAmount 1.00
> >Account 000001 MonthPd 0704 PdAmount 880.60
> >.
> >.<snip> Went threw all accounts/programs for fund 1 move on to fund 2
> >.
> >
> >Oganization 000001
> >Fund 000002
> >Program 000001
> >Account 000001 MonthPd 0704 PdAmount 1.00
> >Account 000001 MonthPd 0704 PdAmount 880.60
> >.
> >.
> >.
> >
> >My Code...sorry that I could not shorten it much more
> >
> >+++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++
> >[Next line is file telling where db is]
> ><!--#include file="include.asp"-->
> >
> ><%
> >
> >Dim connect, rs
> >Dim sSQL
> >Dim connect2, rs2
> >Dim sSQL2
> >Dim connect3, rs3
> >Dim sSQL3
> >Dim ThePD 'Date Paid for monthly reconciling
> >Dim TheYear 'Table in the database - each year is in different table
> >'Hard codeded for testing
> >ThePD = "0704"
> >'Hard coded for testing
> >TheYear = "AllExpenses2004"
> >
> >Set connect = Server.CreateObject("ADODB.Connection")
> >Set rs = Server.CreateOBject("ADODB.Recordset")
> >connect.ConnectionString = _
> > "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> > "Data Source=" & sDataSource
> >connect.Open
> >
> >Set connect2 = Server.CreateObject("ADODB.Connection")
> >Set rs2 = Server.CreateOBject("ADODB.Recordset")
> >connect2.ConnectionString = _
> > "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> > "Data Source=" & sDataSource
> >connect2.Open
> >
> >Set connect3 = Server.CreateObject("ADODB.Connection")
> >Set rs3 = Server.CreateOBject("ADODB.Recordset")
> >connect3.ConnectionString = _
> > "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> > "Data Source=" & sDataSource
> >connect3.Open
> >
> >Set connect4 = Server.CreateObject("ADODB.Connection")
> >Set rs4 = Server.CreateOBject("ADODB.Recordset")
> >connect4.ConnectionString = _
> > "Provider=Microsoft.Jet.OLEDB.4.0;" & _
> > "Data Source=" & sDataSource
> >connect4.Open
> >%>
> >
> ><html>
> ><head>
> ></head>
> ><body>
> ><table border="0">
> ><%
> > sSQL3 = "SELECT Distinct Organization" & _
> > " FROM " & TheYear & _
> > " WHERE MonthPD = '" & ThePD & "'" & _
> > " ORDER BY Organization"
> > set rs3 = Connect.Execute(sSQL3)
> >%>
> ><% Do until rs3.eof %>
> >
> ><%
> > sSQL2 = "SELECT Distinct Fund" & _
> > " FROM " & TheYear & _
> > " WHERE MonthPD = '" & ThePD & "'" & _
> > " ORDER BY Fund"
> > set rs2 = Connect.Execute(sSQL2)
> >%>
> ><% Do until rs2.eof %>
> >
> ><%
> > sSQL4 = "SELECT Distinct Fund, Organization, Program" & _
> > " FROM " & TheYear & _
> > " WHERE MonthPD = '" & ThePD & "'" & _
> > " ORDER BY Organization, Fund, Program"
> > set rs4 = Connect.Execute(sSQL4)
> >%>
> ><% Do until rs4.eof %>
> >
> ><tr>
> ><td>Organization</td>
> ><td colspan="11"><%=rs4("Organization")%></td>
> ></tr>
> ><tr>
> ><td>Fund</td>
> ><td colspan="11"><%=rs4("Fund")%></td>
> ></tr>
> ><tr>
> ><td>Program</td>
> ><td colspan="11"><%=rs4("Program")%></td>
> ></tr>
> ><tr>
> > <td>Account</td>
> > <td>Month PD</td>
> > <td>PD Amount</td>
> ></tr>
> >
> ><%
> >TheFund = rs4("Fund")
> >TheOrg = rs4("Organization")
> >TheProg = rs4("Program")
> >
> >sSQL = "SELECT *" & _
> > " FROM " & TheYear & _
> > " WHERE MonthPD = '" & ThePD & "'" & _
> > " and Fund = '" & TheFund & "'"
> > set rs = Connect.Execute(sSQL)
> >
> >Do until rs.eof
> >%>
> ><tr bgcolor="<%=sBackgroundColor%>">
> > <td class="text"><%=rs("Account")%></td>
> > <td class="text"><%=rs("MonthPd")%></td>
> > <td class="text"><%=rs("PdAmount")%></td>
> ></tr>
> >
> ><% End If
> >rs.MoveNext
> >Loop %>
> ></tr>
> ><tr><tdnbsp;</td></tr>
> >
> ><% rs4.MoveNext
> >Loop %>
> ><% rs2.MoveNext
> >Loop %>
> ><% rs3.MoveNext
> >Loop %>
> ></table>
> ><p>&nbsp;</p>
> ></body>
> ></html>

 
Reply With Quote
 
Abby Lee
Guest
Posts: n/a
 
      07-30-2004
"Rune" <rune[insert current year]@runevision.com> wrote in message news:<(E-Mail Removed)>...
> I don't know about a better way, but if the problem is that your page times
> out, then perhaps Response.Flush can help?
>
> Try to replace this:
>
> <% rs3.MoveNext
> Loop %>
>
> With this:
>
> <%
> Response.Flush
> rs3.MoveNext
> Loop
> %>
>
> If it still times out, try to put Response.Flush before rs2.MoveNext
> instead.
>
> Let me know if it helps.
> (Err, not that I have other ideas if it doesn't help...)
>
> Best regards,
> Rune


Thanks Rune, I will try this on Monday.
 
Reply With Quote
 
Abby Lee
Guest
Posts: n/a
 
      08-02-2004
"Rune" <rune[insert current year]@runevision.com> wrote in message news:<(E-Mail Removed)>...
> I don't know about a better way, but if the problem is that your page times
> out, then perhaps Response.Flush can help?
>
> Try to replace this:
>
> <% rs3.MoveNext
> Loop %>
>
> With this:
>
> <%
> Response.Flush
> rs3.MoveNext
> Loop
> %>
>
> If it still times out, try to put Response.Flush before rs2.MoveNext
> instead.
>
> Let me know if it helps.
> (Err, not that I have other ideas if it doesn't help...)
>
> Best regards,
> Rune


Ok this gets me closer...I put a Response.Flush before each
rs#.MoveNext
However I still get timed out after only part of the data is printed.
Any other ideas?


Active Server Pages error 'ASP 0113'
Script timed out

/eforms/reconcile/reconcile.asp

The maximum amount of time for a script to execute was exceeded. You
can change this limit by specifying a new value for the property
Server.ScriptTimeout or by changing the value in the IIS
administration tools.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms Authentication Fails some times and not some times??? =?Utf-8?B?bWF2cmlja18xMDE=?= ASP .Net 0 03-28-2006 10:48 PM
SetAuthCookie works some times and fails some times? =?Utf-8?B?bWF2cmlja18xMDE=?= ASP .Net 0 03-23-2006 09:24 PM
Please help -- How to run script several times within one document ThunStorm Javascript 0 02-15-2006 03:22 PM
Build a Better Blair (like Build a Better Bush, only better) Kenny Computer Support 0 05-06-2005 04:50 AM
Forking a daemonic Socket listener from a CGI script - browser times out Clyde Ingram Perl Misc 1 12-12-2003 04:11 PM



Advertisments