由于在数据库中有一些记录的值为 Null,因此创建此代码以过滤在“rsActQty”或“rsSumQty”中未分配值的记录集。但是,无论我尝试什么,似乎这段代码都无法检测到 Null 值。而且我不知道我做错了什么。那你能给我一些建议吗?谢谢你。(这个数据库在 MSACCESS 中)
我想要的是: - 仅显示在“rsActQty”或“rsSumQty”中具有价值的记录。- 当此字段之一为 NULL 时,为其分配“0”。
<%
if Rs.eof then
response.write "<tr><td colspan=""6""> "
call displayNotFoundRecord
response.write "</td></tr>"
Else
Dim ActQty, sumQty, Total, rsActQty, rsSumQty, rsPdtn_qty_est, inv_date, res_date
Do while Rs.AbsolutePage = strPageCurrent And Not Rs.EOF
inv_id = rs.fields.item("inv_idRS")
rsActQty = rs.fields.item("sumOfinv_qty_act")
rsSumQty = rs.fields.item("SumOfres_qty")
rsPdtn_qty_est = rs.fields.item("SumOfpdtn_qty_est")
inv_date = rs.fields.item("inv_dateRS")
res_date = rs.fields.item("res_dateRS")
if rsActQty = "" then
ActQty = 0
else
ActQty = rsActQty
end if
if rsSumQty = "" then
sumQty = 0
else
sumQty = rsSumQty
end if
if rsActQty <> "" OR rsSumQty <> "" then
if inv_date = "" then
dateshow = res_date
else
dateshow = inv_date
end if
if res_date = "" then
dateshow = res_date
else
dateshow = res_date
end if
total = rs.fields.item("Total")
%>
<tr class='difcursor'>
<td class="btline" width="25" align="center"><input type="checkbox" name="inv_id" value="<%=inv_id%>" onClick="highlightRow(this,'#FFFFCC','#EFF4FA');"></td>
<td class="btline" <%=genLink(inv_id)%> nowrap style="padding-right: 10px"> <%=rs.fields.item("pd_id")%> </td>
<td class="btline" <%=genLink(inv_id)%> nowrap style="padding-right: 10px"> <%=rs.fields.item("pd_name")%></td>
<td class="btline" <%=genLink(inv_id)%> nowrap style="padding-right: 10px"> <%=PcsToDz(ActQty)%></td>
<td class="btline" <%=genLink(inv_id)%> nowrap style="padding-right: 10px"> <%'=PcsToDz(rs.fields.item("SumOfpdtn_qty_est"))%></td>
<td class="btline" <%=genLink(inv_id)%> nowrap style="padding-right: 10px"> <%=dateshow%></td>
<td class="btline" <%=genLink(inv_id)%> nowrap style="padding-right: 10px"> <%=PcsToDz(sumQty)%></td>
<td class="btline" <%=genLink(inv_id)%> nowrap style="padding-right: 10px"> <%=PcsTODz(Total)%></td>
<td class="btline"></td>
</tr>
<%
end if
Rs.movenext
Loop
End if
Rs.close
set Rs=nothing
Call DBConnClose()
%>