Home All Groups Group Topic Archive Search About
Author
16 Oct 2006 1:03 AM
JB
I have a form with a number of textboxs bound to a datatable which is
populated by a query on SQL server.  Some of the datatable columns are of
type dateTime.  When the user enters a normal date in one of the textboxs
bound to a dateTime column, things work fine.  But if the user wants to
remove the date, it doesn't work, if the user selects the date in the textboz
and hits the delete key, when the focus is shifted to another control, the
original date is shown in the text box.  Next I tried setting the value to
nothing in code 
ds.dtData(index).Birthdate = nothing
If I do this and then look at the column value in the immediate window, the
value is #12:00:00 am# with no date part.  This is not nothing and it is not
a valid date either.  SQL server throws an exception if I try to Update the
server table with this value.  SQL Server will except Null as a date value so
how do I get a datatable to accept a null date?  I have tried setting
nillable = true in the dataset xml table definition but it doesn't seem to
make any difference.  Why doesn't MS make it easy by defining an equivalent
of DbNull.Value that the datatable will accept as a valid date. 
--
JB

AddThis Social Bookmark Button