Check variable for DB null value C#

If a variable comes from the sql database with a NULL value, its not the same as checking the c# variable for =”null” . You need a special line of code:

if (!DBNull.Value.Equals(MyDbVar))

Leave a Reply