asp判断字段为空与不为空

表里有字段1和字段2
如果字段1不为空输出“1”
如果字段2不为空输出“2”
如果字段1和2都不为空输出“3”
如果字段1和2都为空输出“0”
========================================
if 字段1<>"" and 字段2<>"" then
response.Write"3"
else if 字段1<>"" then
response.Write"1"
else if 字段2<>"" then
response.Write"2"
else if 字段1="" and 字段2="" then
response.Write"0"
end if
end if
end if
end if
================================
我这样写输出有错误,谁给我个正解

第1个回答  推荐于2016-01-13
ASP没有判断空变量的函数,用IF语句
<%
IF 记录集("字段")="" Then
Response.Write("空")
Else
Response.Write(记录集("字段"))
End IF
%>

如果是SQL查询语句用 IS NULL或IS NOT NULL本回答被提问者采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网