webdn
 
  首页     免费截图     VIP会员区     广告Banner     技术文档     网站模板  
网站截图,网站每日新 !
网页模板

首页 >> WebDN 技术文档 >> 网络编程 >> ASP 资料大全 >> Page 23>> 学习检测参数是否的为空的Function

 

学习检测参数是否的为空的Function

【摘 要】本文详细介绍学习检测参数是否的为空的Function的文章专题。

因为所输入的参数类型不同,所以判断的方法也不一样。如何正确的判断参数是否为空?

具体的请看下文所示:

<%
'Check a variable isn't "empty"
Function IsBlank(ByRef TempVar)

'by default, assume it's not blank
IsBlank = False

'now check by variable type
Select Case VarType(TempVar)

'Empty & Null
Case 0, 1
IsBlank = True

'String
Case 8
If Len(TempVar) = 0 Then
IsBlank = True
End If

'Object
Case 9
tmpType = TypeName(TempVar)
If (tmpType = "Nothing") Or (tmpType = "Empty") Then
IsBlank = True
End If

'Array
Case 8192, 8204, 8209
'does it have at least one element?
If UBound(TempVar) = -1 Then
IsBlank = True
End If
End Select
End Function
%>

Example Usage
<%
If IsBlank(Session("username"))Then
response.redirect("LoginFail.htm")
End If
%>




电话咨询:010-60520722 QQ咨询:3792656   |   583696287   |   66733350 关于WebDN  |  站点地图  |  联系我们  |  支付方式  |  友情链接
© 2004-2008 WebDN.com 版权所有. 沪ICP备05040479号