DBnull








DBNull.Value.Equals(DataGridView2.CurrentRow.Cells.Item(0).Value)

If DBNull.Value.Equals(Rs.Fields("id").Value) = False Then ' If Val(Rs.Fields("id").Value) > 0 Then



Rs.Open("SELECT DISTINCTROW Max(SostituzionePortieri.Id) AS Id FROM SostituzionePortieri;", Conn, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic)

If DBNull.Value.Equals(Rs.Fields("id").Value) = False Then ' If Val(Rs.Fields("id").Value) > 0 Then
ContatoreRs.Fields("SostituzionePortieri").Value = Rs.Fields("id").Value
Else
ContatoreRs.Fields("SostituzionePortieri").Value = 0
End If




Try
' Open a connection.

cn.Open()
dr = cmd.ExecuteReader()

' Display all fields

Do While dr.Read
Dim res As String = ""
Dim i As Integer
' Iterate over all fields.

For i = 0 To dr.FieldCount - 1
' Insert a comma if necessary.

If res.Length > 0 Then res &= ", "
' Append field name and value.

res &= dr.GetName(i) & "="
If dr.IsDBNull(i) Then
res &= "<NULL>"
Else
res &= dr.GetValue(i).ToString
End If
Next
' Append to the result textbox.

txtOut.AppendText(res & ControlChars.CrLf)
Loop
dr.Close()

Catch ex As OleDbException
Debug.WriteLine(ex.Message)
Finally
' Close the connection.

cn.Close()
End Try










( dbnull.html )- by Paolo Puglisi - Modifica del 17/12/2023