I have run into this problem a few times and have never come up with a good answer. I figure others must have dealt with this already.
I have a datareader returned from the database and I want to use the values therein however values may or may not contain NULL. I would like to have a helper function that takes in the value from the datareader and returns the value if it is not NULL and blank space if it is NULL.
The problem I have is that the data-type of the variable I am testing is variable. It can be a String, and Integer or a DateTime. Can anyone suggest a simple way to test the value and then return the original value (as same data-type if possible) or something else if it is NULL?
I am using VB.NET at the moment but I would also like to know how to do this in C#. Thank you.