关于asp检测数据库中字段值是否为空 50
<%'Checkavariableisn't"empty"FunctionIsBlank(ByRefTempVar)'bydefault,assumeit'snotbla...
<%
'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("huifu")) then 'rs("huifu")是数据库中的一个字段名
response.write "……"后面就不用说了
问题是运行时就出现
错误类型:
Microsoft VBScript 编译器错误 (0x800A03EA)
语法错误
/lyb.asp, line 242
Function IsBlank(ByRef TempVar)
是什么原因呢。。。解决了加分 展开
'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("huifu")) then 'rs("huifu")是数据库中的一个字段名
response.write "……"后面就不用说了
问题是运行时就出现
错误类型:
Microsoft VBScript 编译器错误 (0x800A03EA)
语法错误
/lyb.asp, line 242
Function IsBlank(ByRef TempVar)
是什么原因呢。。。解决了加分 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询