Click to See Complete Forum and Search --> : schedule vb script how to do it


minority
07-28-2005, 04:56 AM
Ok i have created a vb script which basically will run every day automatically to remove user id and users name from the database if they have not completed the investigation yet (This may change to if they dont complete it by target date) but it will still run every day or so.

ok here my script set rsinsert = CreateObject ("ADODB.Connection")
Set rsncr = CreateObject("ADODB.Recordset")
strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Intranet\ncr\database\ncr.mdb;User Id=admin;Password=;"
strSQL = "SELECT Record_ID, Actionee_ID, Actionee FROM Ticket WHERE Investigated = False AND Closed = False"
rsncr.Open strSQL, strCon
Do While not rsncr.EOF
drec = rsncr("Record_ID")
response.write(id)
strSQL = "UPDATE Ticket set [Actionee] = '', [Actionee_ID] = WHERE (Report_ID = "&drec&") "
rsinsert.open = strCon
rsinsert.execute (strSQL)
rsinsert.Close


rsncr.MoveNext
Loop
rsncr.close
Set rsinsert = Nothing
Set rsncr = nothing
set strCon = nothing




Basically i am trying to query database to find all the report_ID that have not been closed or investgated yet and then set the actionee_ID and actionee to null to allow others to investgate this.

I seem to have a problem getting the values from the database to put into my update i aint even sure i am doing this correctly.

I have full access to the server to allow this to run when i choose.

minority
07-28-2005, 04:18 PM
anyone got any tips on this one

minority
07-29-2005, 06:55 AM
take it no one knows how?

JPnyc
07-29-2005, 07:40 AM
Easiest way I can think of is to take this code, make this into a VB executable and run it as a windows scheduled task on the server.

minority
08-01-2005, 03:18 AM
ye that what i am hoping to do but the code for some reason doesnt run not sure if it due to reserved names or not.

if i change strsql2 the second one to actual numbers it seem to work fine but it just errors if i try to get the information from the first sql

schizo
08-01-2005, 04:09 PM
Does the code work in your browser as an ASP script? If it does, you can just schedule a task on the server to open a browser and go to the URL of the script...

minority
08-02-2005, 03:09 AM
aint that a bit dangerous ok fair enough it is on an intranet hmm anyway of hiding it from everyone else.