|
Author: Jenny Nguyen
|
|
How to easily compare DBNull.Value against a data field in data row in VB.NET. We can use the Is operator to do a comparison. You could try this IsDBNull(DataTable.Rows(x).Item("MyValue") OR If (Not r("EquipmentID") Is DBNull.Value) Then See below for an examle: Dim row As DataRow row = dtSites.Rows.Find("Dampier")
For x As Integer = 0 To dt.Rows.Count - 1 Dim r As DataRow = dt.Rows(x)
If (Not r("EquipmentID") Is DBNull.Value) Then
Else 'record field has a null value
End If
'Now loop through the data to process the data.
Next End Sub
|