Function JobInQueue(ByRef MAName, ByRef Profile)
‘Returns the found job and deletes it from the Queue
Dim objDB, sqlQuery, recordset
JobInQueue = FALSE
MAName = “”
Profile = “”
Set objDB = CreateObject(“ADODB.Connection”)
Set recordset = CreateObject(“ADODB.Recordset”)
objDB.Open DB_CONNECT_STRING
sqlQuery = “select top 1 * from ” & DB_TABLE_QUEUE & ” order by priority”
recordset.Open sqlQuery, objDB
If Not recordset.EOF Then
MAName = recordset.Fields(“MA”)
Profile = recordset.Fields(“Profile”)
End If
objDB.Close
If Not MAName = “” Then
WriteLog “Found in Queue: ” & MA & “, ” & Profile
JobInQueue = TRUE
DeleteFromQueue MA, Profile
End If
End Function