ASP blank fields


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: ASP blank fields

  1. #1
    vero Guest

    ASP blank fields

    I notice that on my webpage: when I check if a field in a database is not blank then I write the Item out else I write the word "None".

    I use this for various fields on my page. The problem is that when the field is not blank it won't write the field out.

    Can someone tell me what I'm doing wrong.

    This is how my code looks
    <% if qryEmp(middlename) <> "" then response.write qryEmp(middlename) else response.write "None" end if %>

  2. #2
    Jake Duckworth Guest

    Re: ASP blank fields


    Your problem is that the database field is not blank, it is null... what you
    need to do is convert the null values to an empty string when doing your
    comparison. Try this code:

    <%if qryEmp(middlename) & "" <> "" then
    response.write qryEmp(middlename)
    else
    response.write "None"
    end if %>

    Jake Duckworth


    vero <c_vero00@yahoo.com> wrote:
    >I notice that on my webpage: when I check if a field in a database is not

    blank then
    >I write the Item out else I write the word "None".
    >
    >I use this for various fields on my page. The problem is that when the

    field is not
    >blank it won't write the field out.
    >
    >Can someone tell me what I'm doing wrong.
    >
    >This is how my code looks
    ><% if qryEmp(middlename) <> "" then response.write qryEmp(middlename) else

    response.write
    >"None" end if %>



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center