apexinternet
Programmer
can someone look at this code and see why its timing out?
<%if request("date"<>"" then%><p>Processing Company Queries..</p><%end if%>
<%
'on error resume next
if request("dmin"<>"" then
dim query ' make room for sqlupdate parameters
query="select * from querys"
set conn = Server.CreateObject("ADODB.Connection"
set conn2 = Server.CreateObject("ADODB.Connection"
conn.open "dsn=driversearch2"
conn2.open "dsn=newdriverapps"
set rs=conn.execute(query)
do while not rs.eof
if request("send-"&rs("company")="Yes" or request("sendall"="Yes" then
queryyes=rs("query"
email1=rs("email1"
email2=rs("email2"
email3=rs("email3"
email4=rs("email4"
email5=rs("email5"
query3=rs("query"
query2="select * from results where (" &queryyes
query2=query2 & " and status='approved' and (dated between #"&request("dmin"&"# and #"&request("dmax"&"#) and state<>'HI' and state<>'AK' and state<>'CN' and state<>'MX' and state<>'AU' and state<>'VI'"
response.write "<table><tr><td><font face=arial size=2>Company: " & rs("company"&"<br><br></font>"
response.write "<font face=arial size=2>Query:"&query2&"<br><br></font>"
set rs2=conn2.execute(query2)
' create an aspemail object
count=0
emailcount=0
do while not rs2.eof
if count=150 then exit do
set objmail=createobject("Persits.MailSender"
objMail.IsHTML=True
' build body of email
objMail.ContentTransferEncoding = "Quoted-Printable"
' build body of email
themessage=""
altmessage=altmessage&"This application was provided solely for BestDriverJobs.com recruiting network clients and employees only."&chr(13)&chr(10)
themessage=themessage&"This application was provided solely for BestDriverJobs.com recruiting network clients and employees only."&"<br>"
altmessage=altmessage&"Violation of this notice will result in appropriate legal action."&chr(13)&chr(10)
themessage=themessage&"Violation of this notice will result in appropriate legal action.<br>"
altmessage=altmessage&chr(13)&chr(10)
themessage=themessage&"<br>"
for a=1 to 120
altmessage=altmessage&rs2.Fields(a).Name&": "&rs2.Fields(a).Value & vbCRLF
themessage=themessage&"<b>"&rs2.Fields(a).Name&":</b> "&rs2.Fields(a).Value & "<br>"
next
themessage=themessage& "<b>Background Check</b>: Yes"
altmessage=altmessage & "Background Check: Yes"&chr(13)&chr(10)
objMail.Host="objMail.From="driverapps@bestdriverjobs-apps.com"
'objMail.addaddress "chris@apexid.com"
'objMail.addaddress "hereinz@hotmail.com"
if email1<>" " or emaill<>"" then objMail.addaddress email1
if email2<>" " or email2<>"" then objMail.addaddress email2
if email3<>" " or email3<>"" then objMail.addaddress email3
if email4<>" " or email4<>"" then objMail.addaddress email4
if email5<>" " or email5<>"" then objMail.addaddress email5
'objMail.addaddress "chris@apexid.com"'
objMail.addbcc "chris@apexid.com"
objMail.Subject="Driver Application - "&FormatDateTime(Now)
objMail.Body=themessage
objMail.AltBody=altmessage
objMail.SendToQueue() ' send email
'objMail.Send() ' send email
set objmail=nothing
if err.number<>0 then errortext=errorstext&err.description
emailcount=emailcount+1
rs2.movenext
count=count+1
response.write "</td></tr></table>"
loop
errortext=errortext&"<br><br>"&"Emails Sent to:"&"<br>"
if email1<>"" then errortext=errortext&""&email1
if email2<>"" then errortext=errortext&"-"&email2
if email3<>"" then errortext=errortext&"-"&email3
if email4<>"" then errortext=errortext&"-"&email4
if email5<>"" then errortext=errortext&"-"&email5
errortext=errortext&"<br>"
response.write "<font face=arial size=2>Errors Received:</font><br>"
response.write "<font face=arial size=2>"&errortext&"</font><br>"
response.write "<font face=arial size=2>Total Emails:"&emailcount&"<br><hr><br></font>"
errortext=""
else
if rs.eof<>true then rs.movenext
end if
if rs.eof<>true then rs.movenext
loop
end if
%>
<%if request("date"<>"" then%><p>Processing Company Queries..</p><%end if%>
<%
'on error resume next
if request("dmin"<>"" then
dim query ' make room for sqlupdate parameters
query="select * from querys"
set conn = Server.CreateObject("ADODB.Connection"
set conn2 = Server.CreateObject("ADODB.Connection"
conn.open "dsn=driversearch2"
conn2.open "dsn=newdriverapps"
set rs=conn.execute(query)
do while not rs.eof
if request("send-"&rs("company")="Yes" or request("sendall"="Yes" then
queryyes=rs("query"
email1=rs("email1"
email2=rs("email2"
email3=rs("email3"
email4=rs("email4"
email5=rs("email5"
query3=rs("query"
query2="select * from results where (" &queryyes
query2=query2 & " and status='approved' and (dated between #"&request("dmin"&"# and #"&request("dmax"&"#) and state<>'HI' and state<>'AK' and state<>'CN' and state<>'MX' and state<>'AU' and state<>'VI'"
response.write "<table><tr><td><font face=arial size=2>Company: " & rs("company"&"<br><br></font>"
response.write "<font face=arial size=2>Query:"&query2&"<br><br></font>"
set rs2=conn2.execute(query2)
' create an aspemail object
count=0
emailcount=0
do while not rs2.eof
if count=150 then exit do
set objmail=createobject("Persits.MailSender"
objMail.IsHTML=True
' build body of email
objMail.ContentTransferEncoding = "Quoted-Printable"
' build body of email
themessage=""
altmessage=altmessage&"This application was provided solely for BestDriverJobs.com recruiting network clients and employees only."&chr(13)&chr(10)
themessage=themessage&"This application was provided solely for BestDriverJobs.com recruiting network clients and employees only."&"<br>"
altmessage=altmessage&"Violation of this notice will result in appropriate legal action."&chr(13)&chr(10)
themessage=themessage&"Violation of this notice will result in appropriate legal action.<br>"
altmessage=altmessage&chr(13)&chr(10)
themessage=themessage&"<br>"
for a=1 to 120
altmessage=altmessage&rs2.Fields(a).Name&": "&rs2.Fields(a).Value & vbCRLF
themessage=themessage&"<b>"&rs2.Fields(a).Name&":</b> "&rs2.Fields(a).Value & "<br>"
next
themessage=themessage& "<b>Background Check</b>: Yes"
altmessage=altmessage & "Background Check: Yes"&chr(13)&chr(10)
objMail.Host="objMail.From="driverapps@bestdriverjobs-apps.com"
'objMail.addaddress "chris@apexid.com"
'objMail.addaddress "hereinz@hotmail.com"
if email1<>" " or emaill<>"" then objMail.addaddress email1
if email2<>" " or email2<>"" then objMail.addaddress email2
if email3<>" " or email3<>"" then objMail.addaddress email3
if email4<>" " or email4<>"" then objMail.addaddress email4
if email5<>" " or email5<>"" then objMail.addaddress email5
'objMail.addaddress "chris@apexid.com"'
objMail.addbcc "chris@apexid.com"
objMail.Subject="Driver Application - "&FormatDateTime(Now)
objMail.Body=themessage
objMail.AltBody=altmessage
objMail.SendToQueue() ' send email
'objMail.Send() ' send email
set objmail=nothing
if err.number<>0 then errortext=errorstext&err.description
emailcount=emailcount+1
rs2.movenext
count=count+1
response.write "</td></tr></table>"
loop
errortext=errortext&"<br><br>"&"Emails Sent to:"&"<br>"
if email1<>"" then errortext=errortext&""&email1
if email2<>"" then errortext=errortext&"-"&email2
if email3<>"" then errortext=errortext&"-"&email3
if email4<>"" then errortext=errortext&"-"&email4
if email5<>"" then errortext=errortext&"-"&email5
errortext=errortext&"<br>"
response.write "<font face=arial size=2>Errors Received:</font><br>"
response.write "<font face=arial size=2>"&errortext&"</font><br>"
response.write "<font face=arial size=2>Total Emails:"&emailcount&"<br><hr><br></font>"
errortext=""
else
if rs.eof<>true then rs.movenext
end if
if rs.eof<>true then rs.movenext
loop
end if
%>