Preface
People often hope that at a certain time, a certain ASP program can be automatically performed on a certain job, such as: sending electronic messages, sorting databases, etc.
method
1. You can find the aspexe component to use
2. You can use WSH to handle it. The following article was reprinted to a mainland website (I have forgotten the source~)
WSH is basically the same as ASP except
No need to add ASP delimiter
The archived secondary file is named .vbs
Since asp.dll is not used, object mode without ASP is not applicable
The servo side cannot be included, so some ADO constants need to be declared by themselves
'Do not use Server.CreateObject
SetoConn=CreateObject("Adodb.Connection")
oConn.OpenYourConnString
sSQL="updateAdInfosetAdStatus=0"_
&"whereValidToDate<='"&Date&"'"
oConn.Execute(sSQL)
oConn.Close
SetoConn=Nothing
Save the file as c:scriptsupdateadstatus.vbs. There are two versions of WSH, one is the window version (wscript.exe) and the other is the command column version (cscript.exe). In this example, we will use (cscript.exe), you can execute it under the DOS command column.
c:>cscriptc:scriptsupdateadstatus.vbs
Then you can go to QueryAnalyzer to check whether the data is updated. In actual applications, it is recommended that you use this file to distinguish work in different periods. For example, I will create a batch file called dailytask.bat to perform all the daily routine work. In this way, I just need to put all scripts that should be executed every day into this batch file, and then use ATCommand or SQLServerAgent to execute dailytask.bat regularly
It is strongly recommended to use SQLServerAgent, which will be more efficient and stable than using ATCommand! Setting SQLServerAgent you can execute EnterpriseManager. After expanding, you will see such a picture.
Click Jobs on the right mouse and select NewJob
Select Step Press New
Specify StepName and Type, please select OperatingSystemCommand and set the execution Command
Select Schedule to set your schedule
3. Use vbs program and under the automatic schedule of WINDOWS, specify that IE will start the ASP program you have written and completed.