Error checking for NULL in VBScript

后端 未结 3 1300
死守一世寂寞
死守一世寂寞 2020-12-05 18:02

I have the following VBScript in a Classic ASP page:

function getMagicLink(fromWhere, provider)
    dim url 
    url = \"magic.asp?fromwhere=\" & fromWhe         


        
3条回答
  •  执念已碎
    2020-12-05 18:32

    From your code, it looks like provider is a variant or some other variable, and not an object.

    Is Nothing is for objects only, yet later you say it's a value that should either be NULL or NOT NULL, which would be handled by IsNull.

    Try using:

    If Not IsNull(provider) Then 
        url = url & "&provider=" & provider 
    End if
    

    Alternately, if that doesn't work, try:

    If provider <> "" Then 
        url = url & "&provider=" & provider 
    End if
    

提交回复
热议问题