J
Jon Cosby
Which is it? I have a scalar operation with a sql command, and I want to
check for null values. If I check for dbnull it reads the command as a
string. If I set it to a string, it reads it as dbnull.
Dim dcOrdNumber As SqlCommand
Dim null As DBNull
If dcOrdNumber.ExecuteScalar() Is null Then ...
' Cast from type 'DBNull' to type 'String' is not valid.
If dcOrdNumber.ExecuteScalar() = "NULL" Then ...
' Operator is not valid for type 'DBNull' and string "NULL".
check for null values. If I check for dbnull it reads the command as a
string. If I set it to a string, it reads it as dbnull.
Dim dcOrdNumber As SqlCommand
Dim null As DBNull
If dcOrdNumber.ExecuteScalar() Is null Then ...
' Cast from type 'DBNull' to type 'String' is not valid.
If dcOrdNumber.ExecuteScalar() = "NULL" Then ...
' Operator is not valid for type 'DBNull' and string "NULL".