Have you ever been faced with this scenario? You need to unscrew a Phillips head screw but you only have a similarly sized flat head screwdriver available.

I have and boy was it ever frustrating.

In the end, the screw head was a little chewed up, my wrist hurt from trying to contort my hand, my wife chided me for cursing in front of the kids (after all, I was only trying to replace the batteries in that friggin talking doll in the first place!!) - but hey - it worked!

Part of me clings onto the hope that the original author of the anonymously submitted bit of code below was in a similar situation. He or she didn't know that he had tools available to add a delay to some process. Perhaps the original dev was a loner, a rebel - writing things his way. ...but I have a strong suspicion that it's just a horrible, cruel prank being perpetrated by a rude jerk of a developer. Yep, I think that's it.

Function DelayProcess(nSeconds)
        dim sleep, connn
        Set connn = CreateObject("ADODB.Connection") 
        connn.Open DSNPDF
        ' indicate a number of seconds, up to 59 
        sleep = nSeconds
        ' make sure timeout doesn't expire! 
        connn.commandTimeout = sleep + 5 
        ' if you neede more than 59 seconds, you will need to adjust the SQL: 
        sqlstr = "WAITFOR DELAY '00:00:" & right(clng(sleep),2) & "'" 
        'Response.Write(now & "<p>") 
        connn.Execute sqlstr,,129 
        'Response.Write(now & "<p>") 
        connn.close
        Set connn = Nothing 
    End Function
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!