You are correct. AndAlso
is short circuiting.
However, the error comes by calling CurRow("GuyBook")
(verify this in a debugger to make sure I'm not a liar or making some crazy assumptions or just misremembering* ;-). Before you ask for a value, you need to ask the DataRow if it has a value. That is, use:
CurRow.IsNull("BuyBook")
Happy coding.
*One should just be able to compare with DBNull.Value
or use IsDBNull
. However, I am fairly certain that I ran into a row before that threw these exceptions instead of returning a DBNull
object. Start by finding out -- in the Immediate Window of the Debugger -- exactly which expression throws the exception.