Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Empty DB values


Message #1 by "Sebastiaan Janssen" <genuine2001@h...> on Mon, 14 May 2001 20:28:44
Hello,



Question: 

I have some entries in a database, a guestbook. 

Some people have a homepage and enter them, so they show in the page.

But.. I don't want to show the Table Row when the database entry is empty. 

How do I do that...? I've tried some things, but they don't work.



What shall I do??



Greets,

Sebastiaan.
Message #2 by Ben Meghreblian <benmeg@b...> on Mon, 14 May 2001 23:11:28 +0100
Hi Sebastiaan,

                 In your SQL statement, have something like this:-



SELECT * from tbl_guestbook_entries WHERE database_entry <> ''



Cheers,



ben



At 20:28 14/05/01 +0000, you wrote:

>Hello,

>

>Question:

>I have some entries in a database, a guestbook.

>Some people have a homepage and enter them, so they show in the page.

>But.. I don't want to show the Table Row when the database entry is empty.

>How do I do that...? I've tried some things, but they don't work.

>

>What shall I do??

>

>Greets,

>Sebastiaan.

>
Message #3 by "Brian Matsik" <brianmat@o...> on Mon, 14 May 2001 18:19:41 -0400
Some code would help.  Different implementations of this approach call for

different solutions.



Show us what fails.  You may already have 99% of the solution.



Brian Matsik, MCSD/MCT

President and Senior Consultant

Object Oriented Consulting Services, Inc.

www.oocs.com

-------



Author: "MCSD Fast Track: Solutions Architecture", New Riders

Co-Author: "Professional ADO 2.5", Wrox

Co-Author: "VBScript Programmer's Reference", Wrox

Co-Author: "Professional Visual InterDev 6 Programming", Wrox

Co-Author: "Professional Access 2000 Programming", Wrox

Co-Author: "Beginning SQL", Wrox



-----Original Message-----

From: Sebastiaan Janssen [mailto:genuine2001@h...]

Sent: Monday, May 14, 2001 8:29 PM

To: ASP Web HowTo

Subject: [asp_web_howto] Empty DB values





Hello,



Question:

I have some entries in a database, a guestbook.

Some people have a homepage and enter them, so they show in the page.

But.. I don't want to show the Table Row when the database entry is empty.

How do I do that...? I've tried some things, but they don't work.



What shall I do??



Greets,

Sebastiaan.



Message #4 by "Sebastiaan Janssen" <genuine2001@h...> on Tue, 15 May 2001 07:21:53
Thanks Ben, that was not really what I meant though.



Brian, good idea!

I'll define the problem again. The database entry either is: NULL, an 

empty string, OR "http://". 

This script works, but I can't add: OR "" OR NULL 

To the if statement. What do I do?



<% if ICQListCountry.Fields.Item("Homepage").Value <> "http://" then %>

 <tr align="left" bgcolor="#ffffee" valign="top"> 

  <td bgcolor="#FFFFFF" colspan=3> <b>Homepage:</b><br>

   <A HREF="<%=(ICQListCountry.Fields.Item("Homepage").Value)%>" 

TARGET="_blank"><%=(ICQListCountry.Fields.Item("Homepage").Value)%></a>

  </td>

 </tr>

<% end if %>



Message #5 by "Sebastiaan Janssen" <genuine2001@h...> on Sun, 27 May 2001 21:58:19
As I didn't get an answer on this one, I'll post it again.

Does anybody know why I can't get this to work?



The database entry either is: NULL, an empty string, OR "http://". I don't 

want to display it if that's the case.

This script works, but I can't add: OR "" OR NULL 

To the if statement. What do I do?



<% if ICQListCountry.Fields.Item("Homepage").Value <> "http://" then %>

 <tr align="left" bgcolor="#ffffee" valign="top"> 

  <td bgcolor="#FFFFFF" colspan=3> <b>Homepage:</b><br>

   <A HREF="<%=(ICQListCountry.Fields.Item("Homepage").Value)%>" 

TARGET="_blank"><%=(ICQListCountry.Fields.Item("Homepage").Value)%></a>

  </td>

 </tr>

<% end if %>





Greets, Sebastiaan.
Message #6 by "Ken Schaefer" <ken@a...> on Mon, 28 May 2001 16:07:09 +1000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

: As I didn't get an answer on this one, I'll post it again.

: Does anybody know why I can't get this to work?

:

: The database entry either is: NULL, an empty string, OR "http://". I don't

: want to display it if that's the case.

: This script works, but I can't add: OR "" OR NULL

: To the if statement. What do I do?

:

: <% if ICQListCountry.Fields.Item("Homepage").Value <> "http://" then %>

:  <tr align="left" bgcolor="#ffffee" valign="top">

:   <td bgcolor="#FFFFFF" colspan=3> <b>Homepage:</b><br>

:    <A HREF="<%=(ICQListCountry.Fields.Item("Homepage").Value)%>"

: TARGET="_blank"><%=(ICQListCountry.Fields.Item("Homepage").Value)%></a>

:   </td>

:  </tr>

: <% end if %>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



You'd probably want to encapsulate this into some kind of function to avoid

the messy code, but do it like this:



<%

If ICQListCountry.Fields.Item("Homepage").Value <> "http://" _

    And ICQListCountry.Fields.Item("Homepage").Value <> "" _

    And Not isNull(ICQListCountry.Fields.Item("Homepage").Value) Then



    ' Display



End If

%>



Cheers

Ken






  Return to Index