ASP Include Problems

Discussion in 'ASP General' started by Max Hazelhurst, Feb 10, 2004.

  1. Hi there,

    Got an include file causing a timeout on the server when it's called on...

    The code has a loop in it that I suspect may be the cause...

    I can forward the entire inc file should it be necessary...

    Many thanks as ever..
    Max
    Maxh att zelhurst dott com



    if (user_id = "") Then
    loggedin=false
    do
    user_id=generateID(5)
    user_sql="SELECT tbl_user.user_id FROM
    tbl_user WHERE ((tbl_user.user_id)=" & user_id & ");"
    loop while db_validate(user_id, user_sql)

    user_sql= "INSERT INTO tbl_user (user_id,
    username, lastipaddress, lastcompname, expires )VALUES "
    user_sql= user_sql & "('" & user_id & "','" &
    "','" & Request.ServerVariables("REMOTE_ADDR") & "','" &
    Request.ServerVariables("REMOTE_USER") & "','" & user_expires &
    "');"
    conn.Execute(user_sql)
    end if
     
    Max Hazelhurst, Feb 10, 2004
    #1
    1. Advertising

  2. Max Hazelhurst

    Chris Barber Guest

    <woeful-plea instyleof="Shakespearian Tragedy">
    Doesn't anybody care about code readability, comments, case, error
    handling, and variable declaration anymore?
    </woeful-plea>

    What is the function db_validate() that provides the loop exit point?

    In order to debug you need to fix your code first by making judicious use
    of:

    Option Explicit
    Dimension your variables
    Place comments in the code to say what's going on.
    Never have loops that don't have a 'get out' clause (eg. after 5 seconds
    or 1000 loops etc.).
    Include error traps to detect errors after SQL executions (implies use
    of On Error Resume Next).

    I'm not having a go at *you* but your post is symptomatic of a lot of very
    short requests for help that are patently impossible to comment on without
    the request for 'a short code section that is self-contained and
    demonstrates the issue'.

    To be honest, you seem to have found the issue already - examine your loop
    response in debug mode and I'm sure you'll find the source of the problem.
    At the very least put a get out clause in that allows you to report and
    process the error (if it's an error that's occurring).

    Regards,

    Chris Barber.


    "Max Hazelhurst" <> wrote in message
    news:BC4E97ED.AAA%...
    Hi there,

    Got an include file causing a timeout on the server when it's called on...

    The code has a loop in it that I suspect may be the cause...

    I can forward the entire inc file should it be necessary...

    Many thanks as ever..
    Max
    Maxh att zelhurst dott com



    if (user_id = "") Then
    loggedin=false
    do
    user_id=generateID(5)
    user_sql="SELECT tbl_user.user_id FROM
    tbl_user WHERE ((tbl_user.user_id)=" & user_id & ");"
    loop while db_validate(user_id, user_sql)

    user_sql= "INSERT INTO tbl_user (user_id,
    username, lastipaddress, lastcompname, expires )VALUES "
    user_sql= user_sql & "('" & user_id & "','" &
    "','" & Request.ServerVariables("REMOTE_ADDR") & "','" &
    Request.ServerVariables("REMOTE_USER") & "','" & user_expires &
    "');"
    conn.Execute(user_sql)
    end if
     
    Chris Barber, Feb 10, 2004
    #2
    1. Advertising

  3. Max Hazelhurst

    Chris Barber Guest

    Just so I don't come across as a complete moron, I've already apologised to David for my harsh post having started and email discussion. Turns out that it's not his code (as I should have suspected) but as usual belongs to 'another' developer

    <quote>
    This is a bit of a strange one as I've inherited the maintenance of this site from another developer who is not around to advise...
    </quote>
    Of course ... we're all just fixing someone else's code. Seems like the industry has found a way to self-perpetuate. I write bad code and come back 2 years later to a new boss and fix it thus getting paid twice (unless I'm daft enough to leave my name in the comments of course). Wasn't me honestly, it was my evil twin brother ...

    LoL.

    After feeling guilty for a few mins 'we' may have found a suspect loop that appears to run indefinitely in certain circumstances thus hanging ASP.

    Chris.

    "Chris Barber" <> wrote in message news:...
    <woeful-plea instyleof="Shakespearian Tragedy">
    Doesn't anybody care about code readability, comments, case, error
    handling, and variable declaration anymore?
    </woeful-plea>

    What is the function db_validate() that provides the loop exit point?

    In order to debug you need to fix your code first by making judicious use
    of:

    Option Explicit
    Dimension your variables
    Place comments in the code to say what's going on.
    Never have loops that don't have a 'get out' clause (eg. after 5 seconds
    or 1000 loops etc.).
    Include error traps to detect errors after SQL executions (implies use
    of On Error Resume Next).

    I'm not having a go at *you* but your post is symptomatic of a lot of very
    short requests for help that are patently impossible to comment on without
    the request for 'a short code section that is self-contained and
    demonstrates the issue'.

    To be honest, you seem to have found the issue already - examine your loop
    response in debug mode and I'm sure you'll find the source of the problem.
    At the very least put a get out clause in that allows you to report and
    process the error (if it's an error that's occurring).

    Regards,

    Chris Barber.


    "Max Hazelhurst" <> wrote in message
    news:BC4E97ED.AAA%...
    Hi there,

    Got an include file causing a timeout on the server when it's called on...

    The code has a loop in it that I suspect may be the cause...

    I can forward the entire inc file should it be necessary...

    Many thanks as ever..
    Max
    Maxh att zelhurst dott com



    if (user_id = "") Then
    loggedin=false
    do
    user_id=generateID(5)
    user_sql="SELECT tbl_user.user_id FROM
    tbl_user WHERE ((tbl_user.user_id)=" & user_id & ");"
    loop while db_validate(user_id, user_sql)

    user_sql= "INSERT INTO tbl_user (user_id,
    username, lastipaddress, lastcompname, expires )VALUES "
    user_sql= user_sql & "('" & user_id & "','" &
    "','" & Request.ServerVariables("REMOTE_ADDR") & "','" &
    Request.ServerVariables("REMOTE_USER") & "','" & user_expires &
    "');"
    conn.Execute(user_sql)
    end if
     
    Chris Barber, Feb 10, 2004
    #3
  4. Max Hazelhurst

    Bullschmidt Guest

    Don't know if this would help at all:

    ' Script timeout in seconds for this page.
    ' (60 x 60 = 1 hour.)
    Server.ScriptTimeout = 60 * 60

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Developer
    http://www.Bullschmidt.com
    ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Bullschmidt, Feb 12, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Danny Anderson
    Replies:
    5
    Views:
    507
    Victor Bazarov
    Aug 15, 2003
  2. naveeddil
    Replies:
    0
    Views:
    582
    naveeddil
    Jan 4, 2008
  3. Andreas Bogenberger
    Replies:
    3
    Views:
    932
    Andreas Bogenberger
    Feb 22, 2008
  4. Eric
    Replies:
    10
    Views:
    475
  5. Eric
    Replies:
    0
    Views:
    264
Loading...

Share This Page