BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Null values

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.databases
View previous topic :: View next topic  
Author Message
Rashid
Guest





PostPosted: Fri Jan 02, 2004 11:18 am    Post subject: Null values Reply with quote



hi all,
i am trying to check for null values in date columns but without any luck.

Fields[0].AsDateTime <> 0 then
.........
If Fields[0] contains a date everything is ok. But if it contains null, then
i get an error.
how do i return a false value if fields[0] is a null value.
thanks in advance
rashid


Back to top
Mike Shkolnik
Guest





PostPosted: Fri Jan 02, 2004 11:35 am    Post subject: Re: Null values Reply with quote



Check the IsNull property for TField:

if Fields[0].IsNull then
<...>

--
With best regards, Mike Shkolnik
E-mail: [email]mshkolnik (AT) scalabium (DOT) com[/email]
WEB: http://www.scalabium.com

"Rashid" <mra (AT) pacific (DOT) net.sg> wrote

Quote:
hi all,
i am trying to check for null values in date columns but without any luck.

Fields[0].AsDateTime <> 0 then
.........
If Fields[0] contains a date everything is ok. But if it contains null,
then
i get an error.
how do i return a false value if fields[0] is a null value.
thanks in advance
rashid





Back to top
Rashid
Guest





PostPosted: Fri Jan 02, 2004 12:02 pm    Post subject: Re: Null values Reply with quote



thanks mike
but i still getting error after using your advice:
Project GATSSql.exe raised exception class EVariantInValudArgError with
message 'Invalid argument'.
I checked my data, only the records with the null values are giving this
problems.
any ideas?
rashid



"Mike Shkolnik" <mshkolnik2002 (AT) ukr (DOT) net> wrote

Quote:
Check the IsNull property for TField:

if Fields[0].IsNull then
...

--
With best regards, Mike Shkolnik
E-mail: [email]mshkolnik (AT) scalabium (DOT) com[/email]
WEB: http://www.scalabium.com

"Rashid" <mra (AT) pacific (DOT) net.sg> wrote in message
news:bt3j12$k4o$1 (AT) mawar (DOT) singnet.com.sg...
hi all,
i am trying to check for null values in date columns but without any
luck.

Fields[0].AsDateTime <> 0 then
.........
If Fields[0] contains a date everything is ok. But if it contains null,
then
i get an error.
how do i return a false value if fields[0] is a null value.
thanks in advance
rashid







Back to top
Dan
Guest





PostPosted: Fri Jan 02, 2004 7:53 pm    Post subject: Re: Null values Reply with quote

Have you stepped through this part of your program with the debugger?
Mike is right in using the IsNull test. Do you get the error when this
test is executed, or is it happening somewhere else?

Dan

On Fri, 2 Jan 2004 20:02:02 +0800, "Rashid" <mra (AT) pacific (DOT) net.sg>
wrote:

Quote:
thanks mike
but i still getting error after using your advice:
Project GATSSql.exe raised exception class EVariantInValudArgError with
message 'Invalid argument'.
I checked my data, only the records with the null values are giving this
problems.
any ideas?
rashid



Back to top
pr
Guest





PostPosted: Sat Jan 03, 2004 4:49 am    Post subject: Re: Null values Reply with quote


"Rashid" <mra (AT) pacific (DOT) net.sg> wrote

Quote:
thanks mike
but i still getting error after using your advice:
Project GATSSql.exe raised exception class EVariantInValudArgError with
message 'Invalid argument'.
I checked my data, only the records with the null values are giving this
problems.
any ideas?
rashid


You obviously do something with the date after you test for null.
Now, NULL is not a value but a *state* indicating *no value* which,
depending on the database engine you use, cannot be processed
like real field values. Some dbEngines may return 0 or '' for a null
field thus masking this.

PR


Quote:
"Mike Shkolnik" <mshkolnik2002 (AT) ukr (DOT) net> wrote in message
news:bt3l7j$2m2e$1 (AT) news (DOT) dg.net.ua...
Check the IsNull property for TField:

if Fields[0].IsNull then
...

--
With best regards, Mike Shkolnik
E-mail: [email]mshkolnik (AT) scalabium (DOT) com[/email]
WEB: http://www.scalabium.com

"Rashid" <mra (AT) pacific (DOT) net.sg> wrote in message
news:bt3j12$k4o$1 (AT) mawar (DOT) singnet.com.sg...
hi all,
i am trying to check for null values in date columns but without any
luck.

Fields[0].AsDateTime <> 0 then
.........
If Fields[0] contains a date everything is ok. But if it contains
null,
then
i get an error.
how do i return a false value if fields[0] is a null value.
thanks in advance
rashid









Back to top
Jamie
Guest





PostPosted: Sun Jan 04, 2004 7:37 am    Post subject: Re: Null values Reply with quote

you may want to try this first.
If assigned(Fields) Then If Fields[0].ASDateTime <> 0 then...
some of that way.


Rashid wrote:

Quote:
hi all,
i am trying to check for null values in date columns but without any luck.

Fields[0].AsDateTime <> 0 then
.........
If Fields[0] contains a date everything is ok. But if it contains null, then
i get an error.
how do i return a false value if fields[0] is a null value.
thanks in advance
rashid




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.