• sql数据库为null时候ASP语句判断问题


    我有一个表test1,有字段num,字段num有null值,也有空值,也有其他值,我要用asp语句判断我查询出来的num的值是否为null值。应该怎么写

    严谨一点,要有两层判断:

    If IsNull(Rs("num")) Or Rs("num") = "" Then
    .....
    End If
    因为字段有时会被写入空数据,如果写入了,但数据为空的话,字段的值就是空(""),也就不是Null了,所以要有两层判断。

    。。。。。。。。

    <td>订单金额统计</td>
    <td><%

    sql="select sum(price) as num from [t_order] where DateDiff('d',addtime,now())=0 "&wherestr&""

    set rs=server.createobject("adodb.recordset")
    rs.open sql,conn,0,1
    'rs_total=rs(0)

    If IsNull(Rs("num")) Or Rs("num") = "" then
    response.write "0"
    else
    response.write (rs("num"))
    end if

    rs.close
    Set rs = Nothing
    %>
    </td>

  • 相关阅读:
    python3-基础11
    python3-基础10
    python3-基础9
    python3-基础8
    python3-基础7
    python3-基础6
    phaserjs 总结
    ES6总结
    移动端webview调试
    nodejs的理解
  • 原文地址:https://www.cnblogs.com/apolloren/p/7628806.html
Copyright © 2020-2023  润新知