ASP statement judgment problem when SQL database is null

Source: Internet
Author: User

I have a table test1, there is a field num, the field num has a null value, there is a null value, and there are other values, and I want to use the ASP statement to determine whether the value of num I am querying is a null value. How to write

 

 be rigorous, with two layers of judgment: 

If IsNull (rs ("num")) Or rs ("num") = "Then
.....
End If
because the field is sometimes written to empty data, if it is written, but the data is empty, the value of the field is empty (""), and it is not NULL, so there are two layers to judge.

...

<td> Order Amount Statistics </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 "
Els E
Response.Write ("num")
End If

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

SQL database n ULL the ASP statement to determine the problem

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.