本文整理汇总了VB.NET中System.DBNull类的典型用法代码示例。如果您正苦于以下问题:VB.NET DBNull类的具体用法?VB.NET DBNull怎么用?VB.NET DBNull使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DBNull类的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