Null handling in C#
Posted on 2011-05-12
I have a problem. My stored procedure produces an integer values which I am assigning to an Nullable integer variable.
Dataclass where I call my Stored proc
//Typecasting error happens here . Unable to cast from object to integer datatype
userProfile.NS_ID = Convert.ToInt32(dr.ItemArray);
public int? NMLS_ID
NS_ID is should get an integer..based on which I do my own business logic. but it is expected that 99% of time ..my stored proc would be producing a null because my db is fresh and users have not started using it.
How do i handle this.