Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Blank Date?
Fri, Jan 6 2006 4:48 PMPermanent Link

"Hüseyin Aliz"
Hi,

Is there any way of blanking a date field to a "NULL" instead of 30-12-1899
when not assigned a value?

Regards,
Hüseyin

Fri, Jan 6 2006 4:57 PMPermanent Link

=?iso-8859-15?Q?Andr=E9_Prins?=
Hüseyin Aliz wrote:

> Hi,
>
> Is there any way of blanking a date field to a "NULL" instead of
> 30-12-1899 when not assigned a value?
>
> Regards,
> Hüseyin

Delphi Help:

<quote>

TDateField.Clear

Call the Clear method to give the field a blank value (a NULL value in
SQL terms).

</quote>

--
André Prins
Twain Development
Fri, Jan 6 2006 5:05 PMPermanent Link

"Hüseyin Aliz"
Hi André,

It does not work when i do:

dbisamtabledatefield.clear;

or

OLevDatoEdit.Clear;  // OLevDatoEdit is a TDBDateTime

The value is still 30-12-1899 when posted.

Regards,
Hüseyin


"André Prins" <nomail@nomail.com> skrev i en meddelelse
news:D48BABEF-F70F-46A1-89D2-4E73244B484A@news.elevatesoft.com...
> Hüseyin Aliz wrote:
>
>> Hi,
>>
>> Is there any way of blanking a date field to a "NULL" instead of
>> 30-12-1899 when not assigned a value?
>>
>> Regards,
>> Hüseyin
>
> Delphi Help:
>
> <quote>
>
> TDateField.Clear
>
> Call the Clear method to give the field a blank value (a NULL value in
> SQL terms).
>
> </quote>
>
> --
> André Prins
> Twain Development

Fri, Jan 6 2006 5:25 PMPermanent Link

"Mike Shkolnik"
> Delphi Help:
> TDateField.Clear
Or yourdataset.FieldByName(yourDateField).Value := NULL

PS: also don't forget to check - maybe your use some custom display format
(like dd-mm-yyyy) and this is why you see the 30-12-1899 instead empty date
--
With best regards, Mike Shkolnik
E-mail: mshkolnik@scalabium.com
WEB: http://www.scalabium.com

Fri, Jan 6 2006 5:33 PMPermanent Link

Sean McCall
Huseyin,

How are you reading the value? If you are reading it using
TField.AsDateTime, which returns a TDateTime (double
precision), a null field will return a value of 0 which
represents dec 30, 1899. This works just like
TField.AsInteger which will return 0 if an integer field is
null. You may need to check for TField.IsNull before
interpreting the value of a date field for display.

HTH,

Sean

Hüseyin Aliz wrote:
> Hi André,
>
> It does not work when i do:
>
> dbisamtabledatefield.clear;
>
> or
>
> OLevDatoEdit.Clear;  // OLevDatoEdit is a TDBDateTime
>
> The value is still 30-12-1899 when posted.
>
> Regards,
> Hüseyin
>
>
> "André Prins" <nomail@nomail.com> skrev i en meddelelse
> news:D48BABEF-F70F-46A1-89D2-4E73244B484A@news.elevatesoft.com...
>
>>Hüseyin Aliz wrote:
>>
>>
>>>Hi,
>>>
>>>Is there any way of blanking a date field to a "NULL" instead of
>>>30-12-1899 when not assigned a value?
>>>
>>>Regards,
>>>Hüseyin
>>
>>Delphi Help:
>>
>><quote>
>>
>>TDateField.Clear
>>
>>Call the Clear method to give the field a blank value (a NULL value in
>>SQL terms).
>>
>></quote>
>>
>>--
>>André Prins
>>Twain Development
>
>
>
Fri, Jan 6 2006 5:58 PMPermanent Link

"Hüseyin Aliz"
Hi Mike,

Tried >> yourdataset.FieldByName(yourDateField).Value := NULL
It's displayed as blank but posted with 30-12-1899 on the table Smile

Regards,
Hüseyin


"Mike Shkolnik" <mshkolnik2002@ukr.net> skrev i en meddelelse
news:48C4E852-4492-47E9-9DD6-F023FE6450BC@news.elevatesoft.com...
>> Delphi Help:
>> TDateField.Clear
> Or yourdataset.FieldByName(yourDateField).Value := NULL
>
> PS: also don't forget to check - maybe your use some custom display format
> (like dd-mm-yyyy) and this is why you see the 30-12-1899 instead empty
> date
> --
> With best regards, Mike Shkolnik
> E-mail: mshkolnik@scalabium.com
> WEB: http://www.scalabium.com
>
>

Fri, Jan 6 2006 6:00 PMPermanent Link

"Hüseyin Aliz"
Hi Sean,

The problem is not displaying the value, but how it's saved on the table -
it's saved as 30-12-1899. I could offcourse when showing the value, or
picking it up from a report - set the value as 0 (check for value 30-12-1899
and change it to NULL somehow).

Regards,
Hüseyin


"Sean McCall" <NoSpam@nowhere.com> skrev i en meddelelse
news:EE59B9BF-D2EE-4226-A10F-183EAD08337E@news.elevatesoft.com...
> Huseyin,
>
> How are you reading the value? If you are reading it using
> TField.AsDateTime, which returns a TDateTime (double precision), a null
> field will return a value of 0 which represents dec 30, 1899. This works
> just like TField.AsInteger which will return 0 if an integer field is
> null. You may need to check for TField.IsNull before interpreting the
> value of a date field for display.
>
> HTH,
>
> Sean
>
> Hüseyin Aliz wrote:
>> Hi André,
>>
>> It does not work when i do:
>>
>> dbisamtabledatefield.clear;
>>
>> or
>>
>> OLevDatoEdit.Clear;  // OLevDatoEdit is a TDBDateTime
>>
>> The value is still 30-12-1899 when posted.
>>
>> Regards,
>> Hüseyin
>>
>>
>> "André Prins" <nomail@nomail.com> skrev i en meddelelse
>> news:D48BABEF-F70F-46A1-89D2-4E73244B484A@news.elevatesoft.com...
>>
>>>Hüseyin Aliz wrote:
>>>
>>>
>>>>Hi,
>>>>
>>>>Is there any way of blanking a date field to a "NULL" instead of
>>>>30-12-1899 when not assigned a value?
>>>>
>>>>Regards,
>>>>Hüseyin
>>>
>>>Delphi Help:
>>>
>>><quote>
>>>
>>>TDateField.Clear
>>>
>>>Call the Clear method to give the field a blank value (a NULL value in
>>>SQL terms).
>>>
>>></quote>
>>>
>>>--
>>>André Prins
>>>Twain Development
>>
>>
Fri, Jan 6 2006 6:46 PMPermanent Link

"Hüseyin Aliz"
It was me as usual, sorry for that Smile

I was assigning the date somewhere else in the code... Thanks anyway Smile

Regards,
Hüseyin

"Hüseyin Aliz" <huseyinaliz@hotmail.com> skrev i en meddelelse
news:B7A7C8AE-6A80-4240-BC43-76FF1C1581DF@news.elevatesoft.com...
> Hi Mike,
>
> Tried >> yourdataset.FieldByName(yourDateField).Value := NULL
> It's displayed as blank but posted with 30-12-1899 on the table Smile
>
> Regards,
> Hüseyin
>
>
> "Mike Shkolnik" <mshkolnik2002@ukr.net> skrev i en meddelelse
> news:48C4E852-4492-47E9-9DD6-F023FE6450BC@news.elevatesoft.com...
>>> Delphi Help:
>>> TDateField.Clear
>> Or yourdataset.FieldByName(yourDateField).Value := NULL
>>
>> PS: also don't forget to check - maybe your use some custom display
>> format
>> (like dd-mm-yyyy) and this is why you see the 30-12-1899 instead empty
>> date
>> --
>> With best regards, Mike Shkolnik
>> E-mail: mshkolnik@scalabium.com
>> WEB: http://www.scalabium.com
>>
>>
>
>

Image