Friday, October 29, 2004

How to get a nullable DateTime Field or DataColumn?

Janusys has a Calendar Control that allows null values.

But unfortunately I am using Typed Datasets and having a hell of a time to work with null DateTime Values...

You can set the DateTime Field's MinOccurs Property to "", which allows you to store null values.. but then what ???
Like how do you clear it after you assign a date to it ?

Let's say you have two tables in the TypedDataset dsCustomer, Customers and Orders.
The Built in method :
dsCustomer.Customers.AddCustomersRow( .. , .. , .. , .. )
is a great way to make sure you have everything in place,
but what about the hell with the DateTime Fields ??? LastOrderDate ...

By the way, one other issue for ppl that heve not faced it yet, DateTime.MinValue DOES NOT get stored on a SQL Server. It is smaller then the allowed minimum date in SQL. So, if you try to do so, you get an exception right from the SQL server... :)

So, lets say you tweaked it by giving a DateTime.MinDate during the initialization... Then how am I gonna make it null ?

I will tell you when i find about it ...

Duray AKAR

1 Comments:

Blogger bl0gg32 said...

Janus DateTime control worked well on DataTime fields.

I had to create my own CurrencyEditor component (derived from TextBox) for my currency values.

I tried using Janus's NumericEdit control at first, but had issues when trying to display both Euro and Dollar values on the same form...

Also, I had to create a TaggedMenuItem control for storing Tag values in dynamically created MenuItems :)

I love inheritance...

3:42 PM  

Post a Comment

<< Home