首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

急asp显示无异常但确不正确!

2012-02-08 
急!!!asp显示无错误但确不正确!!!!大家好,我现在有如下一段代码tddivalign center %ifrs( fzb )

急!!!asp显示无错误但确不正确!!!!
大家好,我现在有如下一段代码
<td> <div   align= "center ">
<%if   rs( "fzb ")=null   then  
    response.write   ( "0 ")
else
    response.write   rs( "fzb ")
end   if%>
</div> </td>
意思是想如果字段中有内容就显示,没内容就显示0,可不管我怎么判断0就是不显示,只是有字段值的时候显示那个值,不知道我错在哪?

[解决办法]
把SQL语句改成“select *,isnull(fzb字段,0)as fzd from 表 where 条件”
直接用rs( "fzb ")试一下有没有用呢
[解决办法]
<%if not rs( "fzb ")= " " then
response.write rs( "fzb ")
else
response.write ( "0 ")
end if%>
这样写结果是一样的 我调试过的可以的 用你那种方法我也得不到结果

[解决办法]
这样才行 不能用null检测对是里的数据是否为空,应该 用Isnull 函数
<td> <div align= "center ">
<%if isnull(rs( "fzb ")) then
response.write ( "0 ")
else
response.write rs( "fzb ")
end if%>
</div> </td>

热点排行