本文整理匯總了VB.NET中System.DBNull.Value字段的典型用法代碼示例。如果您正苦於以下問題:VB.NET DBNull.Value字段的具體用法?VB.NET DBNull.Value怎麽用?VB.NET DBNull.Value使用的例子?那麽, 這裏精選的字段代碼示例或許可以為您提供幫助。您也可以進一步了解該字段所在類System.DBNull
的用法示例。
在下文中一共展示了DBNull.Value字段的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: OUtputLabels
Private Sub OUtputLabels(dt As DataTable)
Dim label As String
' Iterate rows of table
For Each row As DataRow In dt.Rows
Dim labelLen As Integer
label = String.Empty
label += AddFieldValue(label, row, "Title")
label += AddFieldValue(label, row, "FirstName")
label += AddFieldValue(label, row, "MiddleInitial")
label += AddFieldValue(label, row, "LastName")
label += AddFieldValue(label, row, "Suffix")
label += vbCrLf
label += AddFieldValue(label, row, "Address1")
label += AddFieldValue(label, row, "AptNo")
label += vbCrLf
labelLen = Len(label)
label += AddFieldValue(label, row, "Address2")
If Len(label) <> labelLen Then label += vbCrLf
label += AddFieldValue(label, row, "City")
label += AddFieldValue(label, row, "State")
label += AddFieldValue(label, row, "Zip")
Console.WriteLine(label)
Console.WriteLine()
Next
End Sub
Private Function AddFieldValue(label As String, row As DataRow, _
fieldName As String) As String
If Not DbNull.Value.Equals(row.Item(fieldName)) Then
Return CStr(row.Item(fieldName)) & " "
Else
Return Nothing
End If
End Function