Link to home
Start Free TrialLog in
Avatar of garethtnash
garethtnashFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP Task Scedule Windows 2003 Server

Hello Experts,

I have an ASP VBScript page, that basically calls a number of MS SQL Stored Procedures, and an ASP function and actions the following -

Selects recepients
Emails recipients
Flags that notification has been sent
copies any expired data to an expired data table
deletes the expired data from the live table...

the ASP page isn't specific to any particular website as it runs the processes above in one batch for all websites on the server.

I really want to be able to use task sceduler to execute the asp scripts on a daily basis..

Any thoughts on this would be great?

Thank you
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="../Connections/recruta2.asp" -->
<%

set JBNotify = Server.CreateObject("ADODB.Command")
JBNotify.ActiveConnection = MM_recruta2_STRING
JBNotify.CommandText = "dbo.jobboardExpiryNotificationRecipients"
JBNotify.CommandType = 4
JBNotify.CommandTimeout = 0
JBNotify.Prepared = true
JBNotify.Parameters.Append JBNotify.CreateParameter("@RETURN_VALUE", 3, 4)
set Recepients = JBNotify.Execute
Recepients_numRows = 0

%>
<%
if not Recepients.eof then
do while not Recepients.eof
Set myMail=CreateObject("CDO.Message")
URLShort=(Recepients("JBSURLShort"))
URLLong= (Recepients("JBSURL")) & "/coms/em/aemail.asp?ID=" & Recepients("JBEID")
ReplyMail=(Recepients("JBSNoReplyEmail"))
myMail.Subject= "You have jobs on " & URLShort & " that expire today"
myMail.From= ReplyMail
myMail.To= ""& Recepients("JBEUsername")&"; "
myMail.CreateMHTMLBody URLLong
myMail.Send
set myMail=nothing
Recepients.MoveNext 
Loop
Set Recepients = nothing 
end if
%>
<%

set ExpirySent = Server.CreateObject("ADODB.Command")
ExpirySent.ActiveConnection = MM_recruta2_STRING
ExpirySent.CommandText = "dbo.jobboardExpiryNotificationSent"
ExpirySent.CommandType = 4
ExpirySent.CommandTimeout = 0
ExpirySent.Prepared = true
ExpirySent.Parameters.Append ExpirySent.CreateParameter("@RETURN_VALUE", 3, 4)
ExpirySent.Execute()

%>
<%

set Copyadverts = Server.CreateObject("ADODB.Command")
Copyadverts.ActiveConnection = MM_recruta2_STRING
Copyadverts.CommandText = "dbo.JobboardMoveExpiredAdvertsStage1"
Copyadverts.CommandType = 4
Copyadverts.CommandTimeout = 0
Copyadverts.Prepared = true
Copyadverts.Parameters.Append Copyadverts.CreateParameter("@RETURN_VALUE", 3, 4)
Copyadverts.Execute()

%>
<%

set DeleteAdverts = Server.CreateObject("ADODB.Command")
DeleteAdverts.ActiveConnection = MM_recruta2_STRING
DeleteAdverts.CommandText = "dbo.JobboardMoveExpiredAdvertsStage2"
DeleteAdverts.CommandType = 4
DeleteAdverts.CommandTimeout = 0
DeleteAdverts.Prepared = true
DeleteAdverts.Parameters.Append DeleteAdverts.CreateParameter("@RETURN_VALUE", 3, 4)
DeleteAdverts.Execute()

%>
<% Response.Redirect"mailsent.asp" %>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bob Butcher
Bob Butcher
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of garethtnash

ASKER

thank you