Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Datetime field in SQLserver database empty?

Reply
Thread Tools

Datetime field in SQLserver database empty?

 
 
Thierry
Guest
Posts: n/a
 
      01-15-2004
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


 
Reply With Quote
 
 
 
 
Michael
Guest
Posts: n/a
 
      01-15-2004
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
"Thierry" <(E-Mail Removed)> wrote in message
news:rXxNb.13125$(E-Mail Removed)-ops.be...
> 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
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [2.4.4] creating a datetime.datetime from an XML xs:dateTime skip@pobox.com Python 2 01-06-2009 01:31 PM
[2.4.4] creating a datetime.datetime from an XML xs:dateTime Martin Python 0 12-27-2008 08:08 PM
mx.DateTime to datetime.datetime mp Python 1 07-28-2006 10:57 PM
datetime: .datetime-.datetime = .timedelta, .time-.time=TypeError ? Christos TZOTZIOY Georgiou Python 3 09-13-2003 10:44 AM
RE: datetime: .datetime-.datetime = .timedelta, .time-.time=TypeError ? Tim Peters Python 0 09-09-2003 12:57 AM



Advertisments