|
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]
|