convert 01/01/0001 to empty string

convert 01/01/0001 to empty string

am 19.10.2005 10:15:02 von Tan

I am using ObjectDataSource bind to DetailView which will contain one of the
column with the value type is date. whenver the value of this column is
empty . then it will be display the date in the format ( 01/01/0001), How
can I convert it to empty string or just string?



Thank you very much

tan

Re: convert 01/01/0001 to empty string

am 19.10.2005 11:26:41 von Islamegy

DateTime type Don't Allow null or empty string.. the only way i found to
workaround this is to convert it to string and check if it's 01/01/0001..
I did myDatetime Class to do this for me when i use ToString() ,
ToShortDateString(),etc...

"Tan @hotmail.com>" wrote in message
news:unD%230TI1FHA.1264@tk2msftngp13.phx.gbl...
>I am using ObjectDataSource bind to DetailView which will contain one of
>the column with the value type is date. whenver the value of this column is
>empty . then it will be display the date in the format ( 01/01/0001), How
>can I convert it to empty string or just string?
>
>
>
> Thank you very much
>
> tan
>

Re: convert 01/01/0001 to empty string

am 19.10.2005 12:07:18 von Sebastian Wojciechowski

create class, inherit from DateTime and overload ToString() method


"Tan @hotmail.com>" wrote in message
news:unD%230TI1FHA.1264@tk2msftngp13.phx.gbl...
>I am using ObjectDataSource bind to DetailView which will contain one of
>the column with the value type is date. whenver the value of this column is
>empty . then it will be display the date in the format ( 01/01/0001), How
>can I convert it to empty string or just string?
>
>
>
> Thank you very much
>
> tan
>

Re: convert 01/01/0001 to empty string

am 19.10.2005 12:22:20 von nomailreplies

Maybe 01/01/0001 is a default value assigned in the table ?

Check the table's design and see if it is a default value.
If it is a default value, change the default value to null or empty.



Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Tan @hotmail.com>" wrote in message
news:unD%230TI1FHA.1264@tk2msftngp13.phx.gbl...
>I am using ObjectDataSource bind to DetailView which will contain one of the column with
>the value type is date. whenver the value of this column is empty . then it will be
>display the date in the format ( 01/01/0001), How can I convert it to empty string or
>just string?
>
>
>
> Thank you very much
>
> tan

Re: convert 01/01/0001 to empty string

am 19.10.2005 12:55:11 von Tan

I can not inherit from DateTime, in .net 2.0 is a sealed class, any
suggestions?
Tan
"Sebastian Wojciechowski"
wrote in message news:OvqHzSJ1FHA.3524@tk2msftngp13.phx.gbl...
>
> create class, inherit from DateTime and overload ToString() method
>
>
> "Tan @hotmail.com>" wrote in message
> news:unD%230TI1FHA.1264@tk2msftngp13.phx.gbl...
>>I am using ObjectDataSource bind to DetailView which will contain one of
>>the column with the value type is date. whenver the value of this column
>>is empty . then it will be display the date in the format ( 01/01/0001),
>>How can I convert it to empty string or just string?
>>
>>
>>
>> Thank you very much
>>
>> tan
>>
>
>

Re: convert 01/01/0001 to empty string

am 20.10.2005 03:39:21 von Otis Mukinfus

Post removed (X-No-Archive: yes)

Re: convert 01/01/0001 to empty string

am 20.10.2005 05:14:52 von nomailreplies

Isn't it simpler to assume that "01/01/0001" is a default value in the
table in question, and that changing that default value to
would simplify the checking/text assignment task ?

Then, checking for IsDBNull / System.DbNull is simple, or use the faster :

bool isNull = (dr[ordinal]==System.DBNull.Value);



Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Otis Mukinfus" wrote in message
news:l7tdl1pg3hvbrkidm17v6n910ie2ii2l7j@4ax.com...
> On Wed, 19 Oct 2005 11:55:11 +0100, "Tan" @hotmail.com>
> wrote:

> If you are using .NET 2.0 you can use System.Nullable
> Look up System.Nullable in the help file.


>>I can not inherit from DateTime, in .net 2.0 is a sealed class, any
>>suggestions?
>>Tan
>>"Sebastian Wojciechowski"
>>wrote in message news:OvqHzSJ1FHA.3524@tk2msftngp13.phx.gbl...
>>>
>>> create class, inherit from DateTime and overload ToString() method
>>>
>>>
>>> "Tan @hotmail.com>" wrote in message
>>> news:unD%230TI1FHA.1264@tk2msftngp13.phx.gbl...
>>>>I am using ObjectDataSource bind to DetailView which will contain one of
>>>>the column with the value type is date. whenver the value of this column
>>>>is empty . then it will be display the date in the format ( 01/01/0001),
>>>>How can I convert it to empty string or just string?
>>>>
>>>> Thank you very much
>>>>
>>>> tan