Skip to content

Instantly share code, notes, and snippets.

@relyky
Last active July 17, 2017 08:01
Show Gist options
  • Save relyky/01bc644c5c0ed2405492 to your computer and use it in GitHub Desktop.
Save relyky/01bc644c5c0ed2405492 to your computer and use it in GitHub Desktop.
VB6, IsNull, 在VB6中出現"NULL值使用不正確"
'# 在VB6中出現"NULL值使用不正確"
'# 參考文章http://www.blueshop.com.tw/board/FUM200501271723350KG/BRD200512090832443X3.html
'# 法一:使用 IIF 與 IsNull 函數
'# [變數] = IIf(IsNull([變數]), [預設值], [變數])
field_value = IIf(IsNull(rs.Fields(9).Value), "", rs.Fields(9).Value)
'# 法二: 串接空字串
'# 變數 = Trim(變數 & "")
field_value = rs.Fields(9).Value & ""
' 註:此例中 rs 是VB6的Recordset物件
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment