Home All Groups Group Topic Archive Search About
Author
11 Jan 2006 3:38 PM
dgk
How do folks handle a situation where a Date that is a column in a
table isn't known for a particular row? Do we just leave it
uninitialized and have it show up in reports as 1/1/0001or something?

Author
11 Jan 2006 3:49 PM
Herfried K. Wagner [MVP]
"dgk" <d**@somewhere.com> schrieb:
> How do folks handle a situation where a Date that is a column in a
> table isn't known for a particular row? Do we just leave it
> uninitialized and have it show up in reports as 1/1/0001or something?

Either use 'Nullable(Of Date)' as column type in .NET 2.0 or 'SqlDateTime',
which is nullable too.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
11 Jan 2006 4:16 PM
dgk
On Wed, 11 Jan 2006 16:49:45 +0100, "Herfried K. Wagner [MVP]"
<hirf-spam-me-here@gmx.at> wrote:

>"dgk" <d**@somewhere.com> schrieb:
>> How do folks handle a situation where a Date that is a column in a
>> table isn't known for a particular row? Do we just leave it
>> uninitialized and have it show up in reports as 1/1/0001or something?
>
>Either use 'Nullable(Of Date)' as column type in .NET 2.0 or 'SqlDateTime',
>which is nullable too.

The database is actually Cache (Intersystems) so I'm not sure how that
would translate. I'll find out.
Author
11 Jan 2006 3:54 PM
Cyril Gupta
This sounds to me a question of preference. Leaving it uninitialized is
quite a good option. Since you know what the date is going to be  you can
always make sure it's uninitialized.

You might also considering storing date in the numerical date format. This
way

20060110... The first four characters are year, then month, then day. It's a
perfectly logical way of storing a date and I use it quite often in my own
applications.

Cheers!
Cyril
Author
11 Jan 2006 4:14 PM
dgk
Show quote Hide quote
On Wed, 11 Jan 2006 21:24:28 +0530, "Cyril Gupta" <nom***@mail.com>
wrote:

>This sounds to me a question of preference. Leaving it uninitialized is
>quite a good option. Since you know what the date is going to be  you can
>always make sure it's uninitialized.
>
>You might also considering storing date in the numerical date format. This
>way
>
>20060110... The first four characters are year, then month, then day. It's a
>perfectly logical way of storing a date and I use it quite often in my own
>applications.
>
>Cheers!
>Cyril
>
I thought about that but we're going to use Crystal Reports and SQL
Reporting Services and those aren't going to like that format.
Author
11 Jan 2006 6:26 PM
Cor Ligthert [MVP]
dgk,

A  dateTime that is empty in a datatime field in a datarow = DBNull.Value
A  dateTime field in a normal Net datatime field that is not initialized =
Nothing,

I hope this helps,

Cor