相关疑难解决方法(0)

在VBScript中检查NULL时出错

我在Classic ASP页面中有以下VBScript:

function getMagicLink(fromWhere, provider)
    dim url 
    url = "magic.asp?fromwhere=" & fromWhere
    If Not provider is Nothing Then ' Error occurs here
        url = url & "&provider=" & provider 
    End if
    getMagicLink = "<a target='_blank' href='" & url & "'>" & number & "</a>"
end function
Run Code Online (Sandbox Code Playgroud)

我不断在行上写一个"Object Required"错误消息If Not provider Is Nothing Then.

值为NULL,或者它不是NULL,为什么我会收到此错误?

编辑:当我调用对象时,我传入NULL,或者传入一个字符串.

vbscript null nothing asp-classic nullreferenceexception

27
推荐指数
2
解决办法
12万
查看次数