Regularly run the ASP program code

Source: Internet
Author: User

Preface

It is often hoped that at a specific time, a certain ASP program can be activated for a specific job, such as sending e-mails and sorting data.

Method

1. You can use the aspexe component.

2. You can use wsh to handle the problem. BelowArticleYes. I have already forgotten the website ~)

Wsh is basically the same as ASP's scheme method
No ASP separator added
The sub-region name of the saved Shard is. vbs.
Because ASP. dll is not used, no ASP object mode is available.
Cannot Use servo terminals, so some ADO constants need to be declared on their own

'Do not use server. Createobject
Set oconn = Createobject ("ADODB. Connection ")
Oconn. Open yourconnstring
Ssql = "Update adinfo set adstatus = 0 "_
& "Where validtodate <= '" & Date &"'"
Oconn. Execute (ssql)
Oconn. Close
Set oconn = nothing
Save the statement as C: scriptsupdateadstatus. vbs and wsh have two versions: Windows (wscript.exe) and command column (cscript.exe). In this example, we will use (cscript.exe ), you can perform the following operations in the DOS command column:

C:> cscript C: scriptsupdateadstatus. vbs

Then, you can go to query analyzer to check whether the metadata is updated. In actual application, we suggest that you use batch of jobs in different time periods, for example, I will create a task named dailytask. bat batch uploads all the daily routine work. In this way, I only need to put all the scripts for daily response in this batch, then use at command or SQL Server Agent to initiate daily dailytask. bat

We strongly recommend that you use the SQL Server Agent, which is more efficient and variable than using the AT command! Set the SQL Server Agent. You can click Enterprise Manager to view the interface after development.

Click "Jobs" on the right and select "new job ".
Select worker step and press new
Specify the step name and type, select operating system command, and set the command of the operation row.
Select schedule to set your schedule

3. Use the vbs program and specify the ASP program that has been compiled by IE in the Windows automatic schedule.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.