本页内容是《ASP判断数据库值是否为空的通用函数》同时我们还提供济宁地区的网站建设,百度,雅虎,google的推广,点金,商友,等营销软件
请输入关键字:

标题搜索 内容搜索  

你现在所在的位置->首页->javascript->ASP判断数据库值是否为空的通用函数

ASP判断数据库值是否为空的通用函数

时间:[2007-10-10 10:44:12]     作者:作者不详

由于各种字段属性不同,判断字段是否为空的方法也各异.

下面是一个通用函数,免去了还要看字段类型之苦.

'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

应用实例:

If IsBlank(rs("upic")) Then
  upicurl="/images/nonepic.jpg"
 Else
  upicurl=rs("upic")
 End If

【声明】本站刊载的《ASP判断数据库值是否为空的通用函数》一文如果有侵害你权益的情况,请联系我们。我们将及时采取措施。
QQ:44637339 Email:just6@163.com Tel:13355163107 Lining studios

友情链接

本页内容是《ASP判断数据库值是否为空的通用函数》 返回顶部
© 2001-2024 Lining studios 济宁速创科技有限公司, All Rights Reserved
 Processed Time:46.875ms
中华人民共和国信息产业部网站备案号: 鲁ICP备09103015号-1