MrAgile
asked on
checking for dbnull values - sqldatareader ordinals
Hi There,
What's the syntax for testing for sqldatareader ordinals for null?I tried something like below but it's not working.
Sean
class.propertyname = reader.GetOrdinal("myID")= = DBNull.Value ? 0 : reader.GetInt32(reader.Get Ordinal("m yID"));
What's the syntax for testing for sqldatareader ordinals for null?I tried something like below but it's not working.
Sean
class.propertyname = reader.GetOrdinal("myID")=
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sounds like what you really want to do is have a COALESCE statement in the sql used to create the reader, to that a NULL value is never returned in the first place.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi jcoehoorn,
I have done this already. I am just making sure that there is no way this thing is going to fall over in a nasty way.
I have done this already. I am just making sure that there is no way this thing is going to fall over in a nasty way.