ASP CODE IS STOPPING THE IIS SERVICE DEAD

  • Thread starter stewert gallington
  • Start date
S

stewert gallington

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
 
E

Egbert Nierop \(MVP for IIS\)

stewert gallington said:
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.
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top