Looping code for an unknown reason!

L

Luke - eat.lemons

Hi,

Im pretty new to asp so all light on this question would be great.

Basically i need to test to see what value is set (where to retrieve the
data from) so ive done it like this:

If Request.Querystring("id") = "" then
TidF=Request.Form("TidF")
Else
TidF=Request.Querystring("id")
End If

The data Request.Form("TidF") comes from a form if submit is pressed.

The data Request.Querystring("id") comes from the url being .asp?id=number

However it seems to keep looping round even though i have ended the if
statement and set the var.

all help would be great thanks.
 
R

Ray Costanzo [MVP]

There's nothing here that would cause a loop. What makes you think
something's looping?

Ray at work
 
A

Anthony Jones

Hi,

Im pretty new to asp so all light on this question would be great.

Basically i need to test to see what value is set (where to retrieve the
data from) so ive done it like this:

If Request.Querystring("id") = "" then
TidF=Request.Form("TidF")
Else
TidF=Request.Querystring("id")
End If

The data Request.Form("TidF") comes from a form if submit is pressed.

The data Request.Querystring("id") comes from the url being .asp?id=number

However it seems to keep looping round even though i have ended the if
statement and set the var.

all help would be great thanks.

There is no way this code can loop. What makes you think it is looping?
 
R

Ray Costanzo [MVP]

The only loop you have in your code starts on line 99. And best as I can
tell, you'll loop through there just fine. (Although I am wondering why you
don't have " AND filled='Y'" in your query.) Inside of your loop, say at
line 100, put this:

Response.Write "In the loop.<hr>"
Response.Flush

What do you see when you load the page?

Ray at work
 
B

Bob Barrows [MVP]

At a certain point the code seems to loop round the whole script and
dosent halt ever since ive added in them lines.

Here is my code:

http://rafb.net/paste/results/qXOfJn50.html
Well obviously we cannot test your code to see the symptoms that lead you to
believe that you have an infinite loop, so you're going to have to help us
out. Start by showing us the source of the page that results from running
this code. Put in some response.writes of your variable values at various
places so we can see what is happening.

Having said that, your coding practices could use some work (yes, I know you
are new to this ... this is not destructive criticicsm: it's intended as
constructive). These do not have anything to do with your problem (I think),
but you should address them:

1. Your connection string - http://www.aspfaq.com/show.asp?id=2126
2. Selstar - http://www.aspfaq.com/show.asp?id=2096
3.Costly recordset loop - http://www.aspfaq.com/show.asp?id=2467
4. Major:problem:
Your use of dynamic sql is leaving you vulnerable to hackers using sql
injection:
http://mvp.unixwiz.net/techtips/sql-injection.html
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23

See here for a better, more secure way to execute your queries by using
parameter markers:
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e

Personally, I prefer using stored procedures, or saved parameter queries as
they are known in Access:

http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&[email protected]

http://groups.google.com/groups?hl=...=1&[email protected]
 
L

Luke - eat.lemons

Ray said:
The only loop you have in your code starts on line 99. And best as I can
tell, you'll loop through there just fine. (Although I am wondering why you
don't have " AND filled='Y'" in your query.) Inside of your loop, say at
line 100, put this:

Response.Write "In the loop.<hr>"
Response.Flush

What do you see when you load the page?

Ray at work
Hi,

Unfortunately that didn't work.

Heres 2 links to videos that explain this abit better!

http://another-site.net/working.avi

http://another-site.net/failed.avi

The first one (working.avi) shows it functional when you use a number
other than 99999. This number is used to manually prompt for a
javascript input box that posts the data back to the page. It works but
it seems to loop round and keep logging in and out.

Thanks agian.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,270
Latest member
TopCryptoTwitterChannels_

Latest Threads

Top