rst("time")=date("15:00:00")
输入结果
response.write rst("time")
asp有个特点,两个变量比较,很可能变为不相等,必须转换为固定类型比较。
<%
aa = "11"
bb = "22"
if aa = bb then '这种写法是错误的。如何写呢,一个必须检查各个是否为空,然后都不为空的时,在用其他来比较
response.write "dsfd"
end if
'下面是一个asp比较终极写法,你只要知道怎么调用就可以了。涉及知识有vb的。
'if
LiGeBiJiao_config1(22,"22",0) then
'if
LiGeBiJiao_config1(rs("ceshi_datetime"),"2012-5-1 10:10:10",0) then
'if
LiGeBiJiao_config1(rs("ceshi_datetime"),"2012-5-1 10:10:10",1) then '判断是否为空 空为true
'if
LiGeBiJiao_config1(rs("ceshi_datetime"),2012-5-1 10:10:10,0) then '错误写法
'if
LiGeBiJiao_config1(cstr(),22,0) then '错误写法
'if
LiGeBiJiao_config1(clng(),"22",0) then '错误写法
'if
LiGeBiJiao_config1(int(),"22",0) then '错误写法
Function LiGeBiJiao_config1(byval diyige,byval dierge,byval kongpan) 'byval byref kongpan 只能 0 或者 1
'on error resume next
'response.write cstr(diyige)&"<br>"
'response.write dierge
'response.end
dim kong11,kong22,tmpkong,tmpType,tmpzhi
'if kongpan = "" or not isnumeric(kongpan) then
'
response.write "LiGeBiJiao_config1 调用错误"
'
response.end
' end if
'//////
kong11 = 0 : kong22 = 0 : LiGeBiJiao_config1 = false
'''''
tmpkong = diyige
Select Case VarType(tmpkong)
Case 0, 1
kong11 = 1
Case 8
If Len(tmpkong) = 0 Then
kong11 = 1
End If
Case 9
tmpType = TypeName(tmpkong)
If (tmpType = "Nothing") Or (tmpType = "Empty") Then
kong11 = 1
End If
Case 8192, 8204, 8209
If UBound(tmpkong) = -1 Then
kong11 = 1
End If
End Select
if int(kongpan) = 1 then
if int(kong11) = 1 then
LiGeBiJiao_config1 = true
end if
exit function
end if
'response.write kong11
'response.end
'''''''//////
tmpkong = dierge
Select Case VarType(tmpkong)
Case 0, 1
kong22 = 1
Case 8
If Len(tmpkong) = 0 Then
kong22 = 1
End If
Case 9
tmpType = TypeName(tmpkong)
If (tmpType = "Nothing") Or (tmpType = "Empty") Then
kong22 = 1
End If
Case 8192, 8204, 8209
If UBound(tmpkong) = -1 Then
kong22 = 1
End If
End Select
'''''''//////
if int(kong11)=1 and int(kong22)=1 then
LiGeBiJiao_config1 = true
exit Function
end if
if int(kong11)=0 and int(kong22)=0 then
'response.write dierge
'response.end
'if diyige = dierge then '错误写法
if cstr(diyige) = cstr(dierge) then
LiGeBiJiao_config1 = true
end if
end if
' response.write LiGeBiJiao_config1
'response.end
End Function