How to handle other types than string i Member profiles
Hi
I've created a custom Profilebase, by following Aaron Powels excellent blogpost here http://www.aaron-powell.com/umbraco-members-profiles.
I can't get to handle undefined datatypes other than strings. From
Aaron's post I test for an undefined string by testing like this:
if (o == DBNull.Value) { return string.Empty; }
I can't seem to test for undefined Boolean or DateTime type this way. I have tried like this:
if (o == null) { return false) } return ((int)0 == 1);
But it doesn't catch it, and then fails when casting to int
How to handle other types than string i Member profiles
Hi
I've created a custom Profilebase, by following Aaron Powels excellent blogpost here http://www.aaron-powell.com/umbraco-members-profiles. I can't get to handle undefined datatypes other than strings. From Aaron's post I test for an undefined string by testing like this:
I can't seem to test for undefined Boolean or DateTime type this way. I have tried like this:
But it doesn't catch it, and then fails when casting to int
How do I test for undefined Boolean and DateTime?
/Bo Kingo
And by the way, I run on MS SQL CE - could that be related? I've seen problems with CE in the forum before.
To answer my own question: It seems that the object returned is a string when undefined, so I fixed it by doing this:
That seems to work and for DateTime too.
is working on a reply...