Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Another NULL-problem
Sun, Mar 16 2008 5:47 PMPermanent Link

Uli Becker
I want to assign a date value from an EDBTable to a DateTimePicker:

if not VarIsNull(MyTableMyDate.value) then
 DateTimePicker.date := MyTableMyDate.value;

Surprisingly this results in an exception.

Investigating further I found that MyTableMyDate.value = 0! Checking this in EDBManager
shows, that the value is actually NULL.

Any idea what is wrong here?

Regards Uli
Mon, Mar 17 2008 3:53 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Uli

>Investigating further I found that MyTableMyDate.value = 0! Checking this in EDBManager
>shows, that the value is actually NULL.
>
>Any idea what is wrong here?

The quick answer is nothing. Everything is working as it should - apart from your expectations Smiley

There is a difference between sql and delphi with null's. eg a VARCHAR in sql may return null (currently at least) but if your access it through .AsString it returns an emptystring, for integers .AsInteger returns 0.

What you need to do is rather than using VarIsNull(MyTableMyDate.value) as your check use MyTableMyDate.IsNull

Roy Lambert

Mon, Mar 17 2008 4:08 AMPermanent Link

Uli Becker
Roy,

> What you need to do is rather than using VarIsNull(MyTableMyDate.value) as your check use MyTableMyDate.IsNull

Thanky, Roy. That helped.

Regards Uli
Image