473,231 Members | 2,049 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

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

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>
Jul 19 '05 #1
5 1599
On 29 Jul 2004 12:26:29 -0700, ab*******@hotmail.com (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>


Jul 19 '05 #2
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
Jul 19 '05 #3
je*********@zina.com (Jeff Cochran) wrote in message news:<41****************@msnews.microsoft.com>...
On 29 Jul 2004 12:26:29 -0700, ab*******@hotmail.com (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>

Jul 19 '05 #4
"Rune" <rune[insert current year]@runevision.com> wrote in message news:<O1**************@TK2MSFTNGP09.phx.gbl>...
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.
Jul 19 '05 #5
"Rune" <rune[insert current year]@runevision.com> wrote in message news:<O1**************@TK2MSFTNGP09.phx.gbl>...
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.
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ken Fine | last post by:
I'm looking to find or create an ASP script that will take a string, examine it for a search term, and if it finds the search term in the string, return the highlighted search term along with the...
10
by: Craig Keightley | last post by:
I have the following array: function showCPUs(){ //name brandID dualCore dualProcessor var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=;
6
by: richard.pasco | last post by:
Hey all I am trying to write a script that allows users to search through a database of names. But rather than give a search string and then return all those that match, I would like it to...
28
by: joshc | last post by:
If I have an array of data that I know to be sorted in increasing order, and the array is less than 50 elements, and I want to find the first element greater than a certain value, is a simple...
60
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
0
by: EC | last post by:
There are times when I use the Search utility of windows explorer to find ASPX file(s) that contains a specific word. The Search utility however skips the <script ..> </script> block in the ASPX...
4
by: Claudio Calboni | last post by:
Hello folks, I'm having some performance issues with the client-side part of my application. Basically, it renders a huge HTML table (about 20'000 cells in my testing scenario), without content....
1
by: Andrew Poulos | last post by:
I'm doing some work with various different Learning Management Systems (LMS) and they each expose an object called "API". The problem is I can't know beforehand how the user may decide to configure...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.