Skip to content

jobRunner.vbs: Sub AddToQueue

Adds new items into the Queue to be processed by the MIIS Scheduling Script.

Const DB_CONNECT_STRING = “Driver={SQL_Server}; Server=MIISServ; Database=MIISData;;”
Const DB_TABLE_QUEUE = “miisQueue”


Sub AddToQueue(Action, Priority)
‘The Action string is the three columns Task, Name and Profile, separated by commas
    Dim objDB, sqlQuery
    Dim Task, Name, Profile

    ‘Split the Action string down into its components
    Task = Left(Action, InStr(Action, “,”)-1)
    Action = Mid(Action, InStr(Action, “,”)+1)
    Name = Left(Action, InStr(Action, “,”)-1)
    Profile = Mid(Action, InStr(Action, “,”)+1)

    ‘Write the fields into the database

    Set objDB = CreateObject(“ADODB.Connection”)

    objDB.Open DB_CONNECT_STRING

    sqlQuery = “insert into ” & DB_TABLE_QUEUE &_

                       ” values (‘” & Task & “‘,’” & Name & “‘,’” &_

                       Profile & “‘,’” & Priority & “)”

    objDB.Execute sqlQuery

    objDB.Close

End Sub