ASP CODE IS STOPPING THE IIS SERVICE DEAD

Discussion in 'ASP General' started by stewert gallington, Sep 4, 2003.

  1. Im running some pretty straight forward code.

    Mainly database access (SQL7) doing inserts and sometimes when the script
    runs it halts the IIS service dead in its tracks. Before the page can even
    finish loading.

    the error seems to be caused when i introduced this section of code into the
    page.

    sub SaveIDC( rec2Save )

    '# Local variable declarations
    Dim myLocalArr
    Dim szIDCID
    Dim szIndividualID
    Dim rsQJIndInfo

    '# Perform the value extractions from the CSV record.
    myLocalArr = breakString( rec2save, "SR" )

    '# get the individual id from the QJIndInfo table based on the QJ User ID.
    set rsQJIndInfo = server.CreateObject("ADODB.Recordset")
    rsQJIndInfo_Open "select * from QJIndInfo where QJUserID = '" &
    myLocalArr(12) & "'", conn, 1, 3

    if rsQJIndInfo.RecordCount > 0 then
    szIndividualID = rsQJIndInfo("Individual_ID")
    else
    szIndividualID = myLocalArr(12)
    end if

    szIDCID = replace(myLocalArr(64), " ", "" ) & "_" & myLocalArr(12) & "-" &
    myLocalArr(13) & "_" & formatdatetime(now(),2)& formatdatetime(now(),3)

    '# Insert the ID card
    Response.Write " <li>Inserting ID Card " & myLocalArr(12) & "...<br>"
    Conn.execute "insert into IDC (IDC_ID, CardNumber, Type, DateIssued,
    IssuingNLC, ExpiryDate, CreationEditDate, IsQwizz ) values ('" & szIDCID &
    "','" & replace(myLocalArr(64), " ", "" ) & "','PIDC','" & REPLACE(
    myLocalArr(65), "-", "/" ) & "','0000','','" & formatdatetime(now(),2) &
    "',-1 )"

    '# Create the Ind_tic_idc record with null ticket ref
    Conn.execute "insert into Ind_Tic_IDC ( Individual_ID, Ticket_ID, IDC_ID )
    values ('" & szIndividualID & "','NULL','" & szIDCID & "')"

    '# Create the Ind_tic_idc record with ticket ref
    Conn.execute "insert into Ind_Tic_IDC ( Individual_ID, Ticket_ID, IDC_ID )
    values ('" & szIndividualID & "','" & szGlobalTic_ID & "','" & szIDCID &
    "')"

    'Update Audit Trail
    conn.execute "insert into AuditTrail
    (User_ID,NLC_ID,Operation,CreationEditDate) values ('QJ_USER','Q" &
    myLocalArr(13) & "','Create IDCARD " & szIDCID & "','" & formatdatetime(
    now(), 2 ) & " " & formatdatetime( now(), 3 ) & "')"

    end sub

    As you can see, pretty straight forward.
    It seems to stop the service about 50% of the time its run.
    Can anyone shed any light.

    Thanks
    Stewert
     
    stewert gallington, Sep 4, 2003
    #1
    1. Advertising

  2. "stewert gallington" <> wrote in message
    news:...
    > Im running some pretty straight forward code.
    >
    > Mainly database access (SQL7) doing inserts and sometimes when the script
    > runs it halts the IIS service dead in its tracks. Before the page can even
    > finish loading.
    >
    > the error seems to be caused when i introduced this section of code into

    the
    > page.


    Your code is very vulnarable...
    Avoid creating strings and executing them on SQL without filtering on the
    string.
    I prefer to use the ADODB.Command to execute inserts and to have a
    ADODB.Parameter to filter arguments.

    This might not solve your 'hang' problem but it could be caused by it. Also
    check for recursive loops or for loops that do not end.
    --
    compatible web farm Session replacement for Asp and Asp.Net
    http://www.nieropwebconsult.nl/asp_session_manager.htm
     
    Egbert Nierop \(MVP for IIS\), Sep 6, 2003
    #2
    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. joe
    Replies:
    1
    Views:
    2,700
    Alan Pretre
    Jul 10, 2003
  2. ThunderMusic

    Prevent service from stopping

    ThunderMusic, Jan 11, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    4,686
  3. DK
    Replies:
    6
    Views:
    2,501
    Peter Hansen
    Aug 18, 2005
  4. Paul Metzger

    Stopping Windows Service

    Paul Metzger, Mar 1, 2006, in forum: Python
    Replies:
    6
    Views:
    2,225
    Larry Bates
    Mar 3, 2006
  5. nano2k
    Replies:
    0
    Views:
    163
    nano2k
    Aug 9, 2007
Loading...

Share This Page