|
 |
asp_databases thread: Re: Images
Message #1 by "Serge Wagemakers" <swagemakers@d...> on Mon, 13 May 2002 10:56:54 +0200
|
|
Couldn't you do something like the following ?
IF IsNull (objRS("image")) THEN
Response.Write ("No image available...")
Else
Response.Write "<img src='images/<%=objRS("image")%>'>"
End IF
It all depends on what the databaserecord has, for the column "image". If it
really is NULL,
then IsNull might help.
Bare in mind though that the name "image" is a reserved word in practically
all databaseservers, so you _might_ see some erroneous results....
Just a thought....
HTH,
Serge
----- Original Message -----
From: <IT@g...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, May 08, 2002 4:53 PM
Subject: [asp_databases] Images
> Hi,
>
> I have a database with the name of an image in it that points to my images
> folder.
>
> In my asp page I declare the image, then use the code:
>
> Image = objRS("Image")
>
> and then later on I I successfully display it using:
>
> <img src="images/<%=image%>">
>
> The above code works fine but some of the records don't have an image and
> I would like it to display nothing if this is true.
>
> For example
>
> IF IsNull (objRS("image")) THEN
> Response.Write ("")
> Else
> Response.Write objRS("image")
>
> This code does not work. Is it the Else statement that is wrong?
>
> Do I have to put <%=image%> in the Else statement?
>
>
> Please help!
>
>
>
>
Message #2 by Mark Eckeard <meckeard2000@y...> on Wed, 8 May 2002 09:38:17 -0700 (PDT)
|
|
Try:
if objRS("Image") is null
Mark.
--- IT@g... wrote:
> Hi,
>
> I have a database with the name of an image in it
> that points to my images
> folder.
>
> In my asp page I declare the image, then use the
> code:
>
> Image = objRS("Image")
>
> and then later on I I successfully display it using:
>
> <img src="images/<%=image%>">
>
> The above code works fine but some of the records
> don't have an image and
> I would like it to display nothing if this is true.
>
> For example
>
> IF IsNull (objRS("image")) THEN
> Response.Write ("")
> Else
> Response.Write objRS("image")
>
> This code does not work. Is it the Else statement
> that is wrong?
>
> Do I have to put <%=image%> in the Else statement?
>
>
> Please help!
>
>
>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
Message #3 by imran.saleem@b... on Wed, 8 May 2002 16:50:20 +0100
|
|
IF objRS("image") = "" THEN
Response.Write ("")
ELSE
Response.Write objRS("image")
END IF
-----Original Message-----
From: IT@g... [mailto:IT@g...]
Sent: Wednesday, May 08, 2002 5:54 PM
To: ASP Databases
Subject: [asp_databases] Images
Hi,
I have a database with the name of an image in it that points to my images
folder.
In my asp page I declare the image, then use the code:
Image = objRS("Image")
and then later on I I successfully display it using:
<img src="images/<%=image%>">
The above code works fine but some of the records don't have an image and
I would like it to display nothing if this is true.
For example
IF IsNull (objRS("image")) THEN
Response.Write ("")
Else
Response.Write objRS("image")
This code does not work. Is it the Else statement that is wrong?
Do I have to put <%=image%> in the Else statement?
Please help!
Message #4 by Jason Greenfeld-Unitek <jason.greenfeld@u...> on Wed, 8 May 2002 11:53:30 -0400
|
|
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C1F6A8.7FE62F10
Content-Type: text/plain;
charset="iso-8859-1"
Try This:
<%Image = objRs("image")%>
<%if not isNull(image) and len(image) <> 0 then%>
'This will take care of a NULL field and an empty string
<img src="images/<%=image%>:>
<%else%>
<p>No Image</p>
<%end if%>
-------------------------------------------
Jason A. Greenfeld
Lead Software Developer
Unitek Technical Services
-----Original Message-----
From: IT@g... [mailto:IT@g...]
Sent: Wednesday, May 08, 2002 12:54 PM
To: ASP Databases
Subject: [asp_databases] Images
Hi,
I have a database with the name of an image in it that points to my images
folder.
In my asp page I declare the image, then use the code:
Image = objRS("Image")
and then later on I I successfully display it using:
<img src="images/<%=image%>">
The above code works fine but some of the records don't have an image and
I would like it to display nothing if this is true.
For example
IF IsNull (objRS("image")) THEN
Response.Write ("")
Else
Response.Write objRS("image")
This code does not work. Is it the Else statement that is wrong?
Do I have to put <%=image%> in the Else statement?
Please help!
Message #5 by IT@g... on Wed, 8 May 2002 16:53:52
|
|
Hi,
I have a database with the name of an image in it that points to my images
folder.
In my asp page I declare the image, then use the code:
Image = objRS("Image")
and then later on I I successfully display it using:
<img src="images/<%=image%>">
The above code works fine but some of the records don't have an image and
I would like it to display nothing if this is true.
For example
IF IsNull (objRS("image")) THEN
Response.Write ("")
Else
Response.Write objRS("image")
This code does not work. Is it the Else statement that is wrong?
Do I have to put <%=image%> in the Else statement?
Please help!
|
|
 |