My SQL field 'modified' is a DateTime type and if the value is NULL in SQL I want to display a 'n/a' string.
I am using FormView templates to display the value.
If I use this statement -> ISNULL(Items.modified,'') AS Modified; I get '1/1/1900 12:00:00 AM' in return.
If I use this statement -> ISNULL(Items.modified,'n/a') AS Modified; I get 'Conversion failed when converting datetime from character string.'
I could go ahead and change my class from "public DateTime Modified" to "public String Modified" but I want the field to represent its real value which is DateTime.
I am not inserting the date value back into the table since the sprocs all take care of that for me. I just want to display the 'n/a' string.
So, is there any way to display a SQL DateTime type as a string when its value is NULL inside the table?
ps: I would prefer not to change any code inside the FormView Templates if possible :)
View Complete Post