You are here: Re: Null Value « PHP SQL « IT news, forums, messages
Re: Null Value

Posted by Hilarion on 10/13/44 11:25

Joel <joel@ecsnj.com> wrote:
> I added a field to my company table (PBV_rstCompany.Fields("Installer")) the
> default value of the field is Null. I place this If statement and it doesn't
> work
>
> If PBV_rstCompany.Fields("Installer") <> "Y" Then
> txtInstaller.Visible = False
> lblInstallerLBL.Visible = False
> cmdNextInstaller.Visible = False
> cmdPrevInstaller.Visible = False
> End If
>
> It assumes the statement is false when in fact it's true... Null in not
> equal "Y"!


This has nothing to do with PHP. You did not specify what the code is.
Is it some stored procedure, user defined function or a trigger (if it's
some external code, than it has not much to do with SQL or PHP, so
I assume it's one of those)? In what DBMS?


In general NULL value is not comparable to any other value (including
NULL). This means that "NULL = some_value", "NULL = NULL", "NULL <> some_value",
"NULL <> NULL" will never be true (it will also never be false, so
"NOT (NULL = some_value)" also will not be true) - it's always UNKNOWN.
Some DBMS engines can have some exceptions to this rule, so you should
check yours (most that do can be switched to ANSI mode to turn off those
exceptions).

You should include "IS NULL" checking in your expressions or use
"NVL" (Oracle) or "ISNULL" (MS SQL) or equivalent to treat NULL value
as some other specified value.


Hilarion

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация