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

前端 未结 3 2119
清歌不尽
清歌不尽 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:41

    The correct code to use is

    Err.Clear
    

    I have tested it with the following code

    <%on error resume next
       response.write (p(10))
       Response.write(Err.Number)
       response.write("
    ") response.write(Err.description) response.write("
    ") Err.Clear Response.write(Err.Number) response.write("
    ") response.write(Err.description) response.write("
    ") %>

    And you can see the correct response is below, which shows the error being cleared

    *13

    Type mismatch

    0*

提交回复
热议问题