2014-07-07 43 views
0

我試圖創建一個ISNULL因此如果沒有發現數據的數據庫字段「停產」什麼也看不見了,如果有日期的頁面顯示:ASP ISNULL - 要麼什麼都不顯示或顯示文字和DB值

中斷:'cut_off'的DB值

無論我做什麼,即使該字段爲空,其文本「Cut off:」總是顯示,就好像「Cut off:」需要在內部一樣後期的數據庫調用。

<% 
If IsNull(rsDB.fields("cut_off")) Then 
    response.write "" 
Else 
    response.write "Cut off:" & (rsDB.Fields.Item("cut_off").Value) 
End if 
%> 
+0

傾向於使用'萊恩(rsDB.fields( 「停產」) 「」)'我自己。簡單。 – Lankymart

回答

0

NULL與空字符串不同。

If (IsNull(rsDB.fields("cut_off"))) OR (Trim(rsDB.fields("cut_off"))="") Then