Forums

ASP

This topic is locked

Not display a text if the DB field is empty

Posted 09 May 2003 12:55:31
1
has voted
09 May 2003 12:55:31 Dalton Gilson posted:
Hi everyone!
I'm building ASP pages where there will be displayed information brought -- in a looping process -- from SQL Server databases - for each "turn" of the loop, there will be "titles" before each kind of info: for instance:
<i>Response.write "Your fax number:&nbsp;" & &#060;objRS("faxnr"&#062;</i>
... but sometimes, some fields of a record may NOT contain any data, or a NULL (if those information are not "required".
So, the problem is specifically this: in this case, the "title" will appear ...followed by nothing!!!?!?...
Then I ask You gurus:
- HOW can I force that piece of text (what a called "title" NOT to appear, not to be displayed-IF-its correspondent field is empty, or NULL?
I'd like to thank You in advance, for your attention.
Dalton Gilson, Rio

Replies

Replied 09 May 2003 14:01:51
09 May 2003 14:01:51 Jonathan Danylko replied:
try this...

&lt;b&gt;Fax Number:&lt;/b&gt;
&lt;% if &lt;%=(rsRecords.Fields.Item("faxnr".Value)%&gt; &lt;&gt; "" then %&gt;
&lt;%=(rsRecords.Fields.Item("faxnr".Value) %&gt;
&lt;% else %&gt;
None
&lt;% end if %&gt;

Hope this helps...



L8R,
Vitoman, M CIW D, MMCP
Replied 09 May 2003 20:36:26
09 May 2003 20:36:26 Dalton Gilson replied:
vitoman
Thanks for your help!
Sincerely yours
Dalton
Replied 09 May 2003 20:56:28
09 May 2003 20:56:28 Jonathan Danylko replied:
Anytime... <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

L8R,
Vitoman, M CIW D, MMCP

Reply to this topic