Error checking for NULL in VBScript

后端 未结 3 1299
死守一世寂寞
死守一世寂寞 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:20

    I will just add a blank ("") to the end of the variable and do the comparison. Something like below should work even when that variable is null. You can also trim the variable just in case of spaces.

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

提交回复
热议问题