Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 16th, 2003, 12:04 PM
Authorized User
 
Join Date: Jul 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Testing true of a database element

i have this cell:

response.write("<td><a href=mailto:"&rs.fields("email")&">"& rs.fields("email") &"</a></td>")

the problem witht he code above is that it shows the email address and uses a lot of cell space.

modified version:

response.write("<td><a href=mailto:"&rs.fields("email")&">"& "email" &"</a></td>")

the above line shows "email" everywhere but I just need it when i have an email in the database.

I am going to test the code below, if some one can help me out to figure this out i would really appreciate it

Thankx!

response.write("<td><a href=mailto:"&rs.fields("email")&">"& "email" &"</a></td>")


...helmut
__________________
...helmut
 
Old July 16th, 2003, 12:08 PM
Authorized User
 
Join Date: Jul 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sorry i didnt post the code i was working with:


response.write(" <td><a href=http://"&rs.fields("url")&" target=""_blank"">"& IF rs.fields("url") = true ("email") else ("") &"</td>")

...helmut
 
Old July 16th, 2003, 12:14 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

You can't concatenate the code like you have. Try something like this instead:
Dim Email
If rs.fields("url") = True Then
    Response.Write("<td><a href=http://" & rs.fields("url")& " target=""_blank"">" & rs.fields("email")& "</td>")
Else
    Response.Write("<td> </td>")
End If


I may have mixed the url and email fields, as I am not sure what you need ware, but I think you'll catch my drift.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 16th, 2003, 12:30 PM
Authorized User
 
Join Date: Jul 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi!

Thanks for your response, now the IF statements work! but they test false all the time :(

If rs.fields("email") = True Then
    response.write("<td><a href=mailto:"&rs.fields("email")&">"& rs.fields("email") &"</a></td>")
Else
    Response.Write("<td></td>")
End If
If rs.fields("url") = True Then
    response.write("<td><a href=http://"&rs.fields("url")&" target=""_blank"">"& rs.fields("url") &"</a></td>")
Else
    Response.Write("<td></td>")
End If

I tried
If rs.fields("url") = 1 Then...

but it gives me an error, is there any other way to test if fields have information in them?

Thank YOU!

...helmut
 
Old July 16th, 2003, 12:32 PM
Authorized User
 
Join Date: Jul 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

wait!

i need to declare the variables first

ahhh.. sorry i have been spoiled by flash :o(

...helmut





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem adding element to the previous element dani1 XSLT 5 September 10th, 2008 01:38 AM
translate element name to element name lexzeus XSLT 3 September 4th, 2006 09:04 AM
adding of element and assigning to one element sushovandatta XSLT 2 November 16th, 2004 07:04 PM
True DBGrid 8.0 KalluMama Pro VB 6 1 August 10th, 2004 01:39 AM
Stupid but true Adam H-W SQL Server 2000 3 December 6th, 2003 12:16 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.