ASP.Net: Checking a variable for a null value
April 25, 2005
I had to check a variable for a null value today, so I tried the ‘old
fashioned’ (Classic ASP) way:
If IsNull(rs(“Name”)) Then…
This didnt work – Visual Studio complained and told me I should be using
DBNull type, for which the syntax isnt exactly obvious.
Heres what works:
If rsCompany(“Name”) is DBNull.Value then