I have got this code below:
Dim lJobName As String = \"\"
SQLCommand.CommandText = \"Select JobName from Jobs where Id = @Id \"
SQLCommand.Parameters.Add(New
Whatever the manual says, comparing to Nothing does not work. So If lJobName Is Nothing
will NOT be triggered when the result set is empty.
Comparing to DBNull.Value DID work for me:
If lJobName Is DBNull.Value Then
'Do something with the error condition
Else
'Do something with lJobName which contains a valid result.
End If
It is worth noting that when the result set is empty (i.e. no records were found), this is not an "error".