Datetime field in SQLserver database empty?

  • Thread starter Thread starter Thierry
  • Start date Start date
T

Thierry

Hi,



I've got the next problem: I have a datetime field in my database
(sql-server) and I want the option in it that this field can be empty. But
if I leave that datetime field empty I get the error:

"The value you entered is not consistent with the data type or length of the
column."



Is it possible to leave that field empty and how is it possible? If not what
do I have to do to leave it empty, because in my application this (date) is
not a required field?



Thanks for your help,

Thierry
 
If someone else knows a better way I'm all ears,

The only way I know how to have a truly empty date is to allow nulls in the
datetime field. Then in code, you can set the variable you are updating
with to System.DBnull.Value. Or if you are working off typed datasets, you
can use myDataSet.myTable(rowNum).setField_NameNull(), at least something
like that I'm not sure if that syntax is correct.

--Michael
 
Back
Top