Cases where you would check for null
In the code
In the code below, we try to access a non existent field
again null is printed out.
Cases where you would check for DBNull.value
Here dr is an instance of the SqldataReader class. Assume that the database returns null as the value for the column "xxx"
However note that neither checking null of nor DBNull.value will work if the index is out of range. If we check for an index or a column that doesn't exist, it will throw an index out of range exception.