using “on error resume next” in classic ASP, and how to handle errors

前端 未结 3 2118
清歌不尽
清歌不尽 2021-02-14 03:49

Good day all, I would like to ask a thing about on error resume next

let\'s assume we have a loop to navigate through a recordset like:

Do w         


        
3条回答
  •  梦如初夏
    2021-02-14 04:42

    VBScript resets the error on goto 0:

    on error resume next
    i = 1 / 0
    WScript.echo( err.number ) '' prints 11 (div by 0)
    on error goto 0
    WScript.echo( err.number ) '' prints 0 (no error)
    

    There is also the explicit err.clear().

提交回复
热议问题