Show if DB field NOT NULL

Discussion in 'ASP General' started by Keith, Jul 9, 2004.

  1. Keith

    Keith Guest

    What is the correct code to use to hide a section if a specific DB field is
    NULL.

    Thanks
    Keith, Jul 9, 2004
    #1
    1. Advertising

  2. "Keith" wrote:
    > What is the correct code to use to hide a section if a specific DB
    > field is NULL.


    Define "hide a section".


    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms. Please do not contact
    me directly or ask me to contact you directly for assistance. If your
    question is worth asking, it's worth posting.
    Dave Anderson, Jul 10, 2004
    #2
    1. Advertising

  3. Keith

    Jeff Cochran Guest

    On Fri, 9 Jul 2004 23:39:15 +0100, "Keith" <@.> wrote:

    >What is the correct code to use to hide a section if a specific DB field is
    >NULL.


    Hide a section as in using DHTML to hide/unhide? Try a DHTML group
    for that answer.

    If you're looking for an ASP-only answer:

    IF DBField <> Null Then
    Response.Write "Hidden Section"
    End If

    Jeff
    Jeff Cochran, Jul 10, 2004
    #3
  4. Keith

    Keith Guest

    Sorry - badly written question.

    Hide a section as in don't process a section of the page if a DB field is
    NULL

    "Dave Anderson" <> wrote in message
    news:40ef4669$0$235$...
    > "Keith" wrote:
    > > What is the correct code to use to hide a section if a specific DB
    > > field is NULL.

    >
    > Define "hide a section".
    >
    >
    > --
    > Dave Anderson
    >
    > Unsolicited commercial email will be read at a cost of $500 per message.

    Use
    > of this email address implies consent to these terms. Please do not

    contact
    > me directly or ask me to contact you directly for assistance. If your
    > question is worth asking, it's worth posting.
    >
    >
    Keith, Jul 10, 2004
    #4
  5. Jeff Cochran wrote:
    > On Fri, 9 Jul 2004 23:39:15 +0100, "Keith" <@.> wrote:
    >
    >> What is the correct code to use to hide a section if a specific DB
    >> field is NULL.

    >
    > Hide a section as in using DHTML to hide/unhide? Try a DHTML group
    > for that answer.
    >
    > If you're looking for an ASP-only answer:
    >
    > IF DBField <> Null Then
    > Response.Write "Hidden Section"
    > End If
    >
    > Jeff

    Minor correction:
    IF Not DBField Is Null Then

    or

    If IsNull(DBField) = False Then

    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows [MVP], Jul 10, 2004
    #5
  6. Keith

    Jeff Cochran Guest

    On Sat, 10 Jul 2004 08:50:10 -0400, "Bob Barrows [MVP]"
    <> wrote:

    >Jeff Cochran wrote:
    >> On Fri, 9 Jul 2004 23:39:15 +0100, "Keith" <@.> wrote:
    >>
    >>> What is the correct code to use to hide a section if a specific DB
    >>> field is NULL.

    >>
    >> Hide a section as in using DHTML to hide/unhide? Try a DHTML group
    >> for that answer.
    >>
    >> If you're looking for an ASP-only answer:
    >>
    >> IF DBField <> Null Then
    >> Response.Write "Hidden Section"
    >> End If
    >>
    >> Jeff

    >Minor correction:
    >IF Not DBField Is Null Then
    >
    >or
    >
    >If IsNull(DBField) = False Then


    Bleh! Should stop answering posts at 2:00 am... :)

    Especially since I just ran through an IsNull() programming section
    during the day.

    Jeff
    Jeff Cochran, Jul 10, 2004
    #6
  7. Keith

    Jeff Cochran Guest

    On Sat, 10 Jul 2004 13:34:28 +0100, "Keith" <@.> wrote:

    >Sorry - badly written question.
    >
    >Hide a section as in don't process a section of the page if a DB field is
    >NULL


    You can't "not process a page" because until you process the page you
    can't determine if the field is null. You can branch based on it
    being null, or else you'll need to use two pages, or try to accomplish
    a conditional include, which is more work thatn the system should do.

    Jeff

    >"Dave Anderson" <> wrote in message
    >news:40ef4669$0$235$...
    >> "Keith" wrote:
    >> > What is the correct code to use to hide a section if a specific DB
    >> > field is NULL.

    >>
    >> Define "hide a section".
    >>
    >>
    >> --
    >> Dave Anderson
    >>
    >> Unsolicited commercial email will be read at a cost of $500 per message.

    >Use
    >> of this email address implies consent to these terms. Please do not

    >contact
    >> me directly or ask me to contact you directly for assistance. If your
    >> question is worth asking, it's worth posting.
    >>
    >>

    >
    Jeff Cochran, Jul 10, 2004
    #7
  8. Keith

    Binoj Antony Guest

    IF (NOT ISNULL(DBField)) THEN
    ' Do something
    ELSE
    ' Do Something else
    END IF

    This works best for me...
    Binoj Antony, Jul 12, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page