Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Why is this an endless loop?
Old 05-26-2008, 01:46 PM Why is this an endless loop?
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
Code:
 
<script language="jscript" runat="server">
var Val1 = ProductData.Fields("Category");
var Val2 = ProductData.Fields("Menu");
var Hdr = ProductData.Fields("Category").value;
var Itm = ProductData.Fields("Menu").value;
while(Hdr == Val1);
{
Itm = ProductData.Fields("Menu").value; 
Response.Write(Itm + "\r");
while(Itm == Val2);
{
ProductData.MoveNext;
}
}
</script>
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-26-2008, 08:40 PM Re: Why is this an endless loop?
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
You need to assure that the conditions get met. Your code doesn't give us sufficient hint to help.
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 05-28-2008, 12:42 AM Why does this simple little script bring my server to its knees?
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
I am writing an "ASP / jscript" site, this script when included in a file


Code:
 <!--#include file = "Menu.asp"-->
brings the server to it's knees, the database is only 5 x 143, I am using the same recordset all over the site.

Code:
<script language="jscript" runat="server">
var TestVal1 = ProductData.Fields("Category");
var TestVal2 = ProductData.Fields("Menu");
var Heading = ProductData.Fields("Category").Value;
var Item = ProductData.Fields("Menu").Value;
while(Heading = TestVal1);
{
ProductData.MoveNext
} 
</script>
If I substitue the following script, no problem.

Code:
<script language="jscript" runat="server">
var TestVal1 = ProductData.Fields("Category");
var TestVal2 = ProductData.Fields("Menu");
var Heading = ProductData.Fields("Category").Value;
var Item = ProductData.Fields("Menu").Value;
var x
while(x=0);
{
x=1
} 
</script>
?
!?
?? ?...?
Really confused... Too much coffee... need help... PLEASE!
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 05-28-2008, 07:50 AM Re: Why is this an endless loop?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
[merged two thread on same topic]

while(Heading == TestVal1);


Equality is == in J(ava)script

(0 = true !0 = false) BTW

so your second example says

while(x) {
x = false
}
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?

Last edited by chrishirst; 05-28-2008 at 07:56 AM.. Reason: hit submit too early
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-28-2008, 06:58 PM Re: Why is this an endless loop?
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
For those with a need to know,

while(condition); is incorrect!

while(condition) is correct!

1-1/2 days! Priceless!
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 05-28-2008, 07:15 PM Re: Why is this an endless loop?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
I missed the semi colon as well FWIW
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Why is this an endless loop?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17024 seconds with 12 queries