Datetime field in SQLserver database empty?

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
 
M

Michael

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top