本文整理汇总了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