Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Server Crashes 1

Status
Not open for further replies.

mikeadmin

MIS
Oct 22, 2001
38
US
Can someone have a look at my code to see why it may crash my server everytime I run it. The other pages work fine.
NT4.0
IIS.4.0
CFServer4.0
Thanks


<!---
findlot.cfm
--->
<!--- enforce security --->
<CFSET #Privelige#=&quot;Claim&quot;>
<CFINCLUDE TEMPLATE=&quot;/PDC/openContent.cfm&quot;>

<!--- optional parameters --->
<CFPARAM NAME=&quot;NameSearchString&quot; DEFAULT=&quot;[^-aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890,<>./?;:{}[[]]`~!@$&*()+=\| ##[%][_]]&quot;>


<!--- get the matching Lot --->
<CFQUERY NAME=&quot;Lot&quot; DATASOURCE=&quot;PDC&quot;>
SET NOCOUNT ON
SELECT DISTINCT LotID
From Lot
WHERE Lot.LotID LIKE
'%#NameSearchString#%' ORDER BY LotID
</CFQUERY>

<!--- get the claim window --->
<CFQUERY NAME=&quot;ClaimWindow&quot; DATASOURCE=&quot;PDC&quot;>
SET NOCOUNT ON
SELECT ClaimStart, ClaimLength
FROM Person, Account, BillingMethod
WHERE Person.PersonID = #Cookie.CurrentPersonID#
AND Person.AccountID = Account.AccountID
AND Account.BillingMethodID = BillingMethod.BillingMethodID
</CFQUERY>

<H1>Find Lot</H1>

<!--- two primary columns --->
<TABLE>
<TR><TD VALIGN=&quot;TOP&quot;>
<!--- display the results --->
<TABLE>
<CFLOOP QUERY=&quot;Lot&quot;>
<TR>
<TD VALIGN=&quot;TOP&quot;>
<!--- get the Lot --->
<CFQUERY NAME=&quot;Lot&quot; DATASOURCE=&quot;PDC&quot;>
SET NOCOUNT ON
SELECT DISTINCT LotID
From Lot
WHERE Lot.LotID LIKE
'%#NameSearchString#%' ORDER BY LotID
</CFQUERY>

<!--- output --->
<TD>
<CFOUTPUT>
 <a HREF=&quot;../../Claim/enterItemClaims.cfm?LotID=#LotID#&quot;>#LotID#</a>
</CFOUTPUT>
</CFLOOP>
</TD>

<!--- allow the user to enter another search --->
<CFFORM METHOD=&quot;POST&quot; ACTION=&quot;#CGI.Path_Info#&quot;>
<TABLE>
<TR>
<TD>Lot#: </TD>
</TR>
<TR>
<TD><CFINPUT TYPE=&quot;TEXT&quot; NAME=&quot;NameSearchString&quot;></TD>
</TR>
<TR>
<TD>
<INPUT TYPE=&quot;SUBMIT&quot; VALUE=&quot;Search&quot;>
<INPUT TYPE=&quot;RESET&quot; VALUE=&quot;Reset&quot;>
</TD>
</TR>
</TABLE>
</CFFORM>
</TR>
</TABLE>

<CFINCLUDE TEMPLATE=&quot;/PDC/closeContent.cfm&quot;><!---
enterLotReport.cfm






 
The problem is the code creates the query &quot;Lot&quot; before the loop...

=== START CODE ===
[COLOR=666666]<!--- optional parameters --->[/color]
<CFPARAM NAME=&quot;NameSearchString&quot; DEFAULT=&quot;
Code:
[
^-aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ1234567890,<>./?;:{}
Code:
[
Code:
[
Code:
]
Code:
]
`~!@$&*()+=\| ##
Code:
[
%
Code:
]
Code:
[
_
Code:
]
Code:
]
&quot;
>


[COLOR=666666]<!--- get the matching Lot --->[/color]
<CFQUERY NAME=&quot;Lot&quot; DATASOURCE=&quot;PDC&quot;>
SET NOCOUNT ON
SELECT DISTINCT LotID
From Lot
WHERE Lot.LotID LIKE
'%#NameSearchString#%' ORDER BY LotID
</CFQUERY>
=== END CODE ===

Then as it loops through the Query &quot;Lot&quot;, it re-defines the same query &quot;Lot&quot;, which will put the loop in an infinite cycle and bring the server to it's knees.

=== START CODE ===
<CFLOOP QUERY=&quot;Lot&quot;>
Code:
[
i
Code:
]
Code:
[
code....
Code:
]
Code:
[
/i
Code:
]
[COLOR=666666]<!--- get the Lot --->[/color]
<CFQUERY NAME=&quot;Lot&quot; DATASOURCE=&quot;PDC&quot;>
SET NOCOUNT ON
SELECT DISTINCT LotID
From Lot
WHERE Lot.LotID LIKE
'%#NameSearchString#%' ORDER BY LotID
</CFQUERY>
Code:
[
i
Code:
]
Code:
[
code....
Code:
]
Code:
[
/i
Code:
]
</CFLOOP>
=== END CODE ===

Try changing the name of the 2nd Query to something else, like &quot;Lot2&quot;:

=== START CODE ===
<CFLOOP QUERY=&quot;Lot&quot;>
Code:
[
i
Code:
]
Code:
[
code....
Code:
]
Code:
[
/i
Code:
]
[COLOR=666666]<!--- get the Lot --->[/color]
<CFQUERY NAME=&quot;Lot2&quot; DATASOURCE=&quot;PDC&quot;>
SET NOCOUNT ON
SELECT DISTINCT LotID
From Lot
WHERE Lot.LotID LIKE
'%#NameSearchString#%' ORDER BY LotID
</CFQUERY>
[COLOR=666666]<!--- output --->[/color]
[COLOR=008080]<TD>[/color]
<CFOUTPUT>
<a HREF=&quot;../../Claim/enterItemClaims.cfm?LotID=#Lot2.LotID#&quot;>#Lot2.LotID#</a>
</CFOUTPUT>
[COLOR=008080]</TD>[/color]
</CFLOOP>
=== END CODE ===
- tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top