473,326 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

if.. else.. statement problem

Hi

I'm fairly new to coding in asp and i'm trying to create a simple if..
else... condition
It's for asp web page, and is linked to my database, but i figured since
it's a basic question, it would belong in the General newsgroup.

All i am trying to, is, on my web page I have a table cell, that feeds off
my database.
If there's something in the database in that particular field, then I want
it to be displayed, If not, then rather the cell return a blank field, I
want a picture from another field.

<%
if rsSublisting("Specific_imagelrg") > "" then
%>
<%=rsSublisting("Specific_imagelrg")%>

<% end if %>

I've tried without luck to include an Else field, i.e if there is not
content in the above field, i want to display a different field, called
("Img_lrg")
How do i ammend the script?

Thanks

Raphael
Jul 19 '05 #1
5 1697
Try this:

<%
if rsSublisting("Specific_imagelrg") <> "" then
%>
<%=rsSublisting("Specific_imagelrg")%>

<% end if %>

"Raphael Gluck" <so***@nospam.com> wrote in message
news:#c*************@tk2msftngp13.phx.gbl...
Hi

I'm fairly new to coding in asp and i'm trying to create a simple if..
else... condition
It's for asp web page, and is linked to my database, but i figured since
it's a basic question, it would belong in the General newsgroup.

All i am trying to, is, on my web page I have a table cell, that feeds off
my database.
If there's something in the database in that particular field, then I want
it to be displayed, If not, then rather the cell return a blank field, I
want a picture from another field.

<%
if rsSublisting("Specific_imagelrg") > "" then
%>
<%=rsSublisting("Specific_imagelrg")%>

<% end if %>

I've tried without luck to include an Else field, i.e if there is not
content in the above field, i want to display a different field, called
("Img_lrg")
How do i ammend the script?

Thanks

Raphael

Jul 19 '05 #2
Raphael Gluck wrote:
Hi

I'm fairly new to coding in asp and i'm trying to create a simple if..
else... condition
It's for asp web page, and is linked to my database, but i figured
since it's a basic question, it would belong in the General newsgroup.

All i am trying to, is, on my web page I have a table cell, that
feeds off my database.
If there's something in the database in that particular field, then I
want it to be displayed, If not, then rather the cell return a blank
field, I want a picture from another field.

<%
if rsSublisting("Specific_imagelrg") > "" then
Response.write rsSublisting("Specific_imagelrg")
Else
Response.write rsSublisting("Img_lrg")
end if
%>

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #3
ooops!
did not read the question good enough....

sorry!
"Christopher Brandsdal" <br*******@binaer.no> wrote in message
news:Od**************@TK2MSFTNGP10.phx.gbl...
Try this:

<%
if rsSublisting("Specific_imagelrg") <> "" then
%>
<%=rsSublisting("Specific_imagelrg")%>

<% end if %>

"Raphael Gluck" <so***@nospam.com> wrote in message
news:#c*************@tk2msftngp13.phx.gbl...
Hi

I'm fairly new to coding in asp and i'm trying to create a simple if..
else... condition
It's for asp web page, and is linked to my database, but i figured since
it's a basic question, it would belong in the General newsgroup.

All i am trying to, is, on my web page I have a table cell, that feeds off my database.
If there's something in the database in that particular field, then I want it to be displayed, If not, then rather the cell return a blank field, I
want a picture from another field.

<%
if rsSublisting("Specific_imagelrg") > "" then
%>
<%=rsSublisting("Specific_imagelrg")%>

<% end if %>

I've tried without luck to include an Else field, i.e if there is not
content in the above field, i want to display a different field, called
("Img_lrg")
How do i ammend the script?

Thanks

Raphael


Jul 19 '05 #4
Hi,

Thanks for that, I tried it, but it's still not working.
I get the following error,
"Item cannot be found in the collection corresponding to the requested name
or ordinal."

The Item does exist in my database,

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Raphael Gluck wrote:
Hi

I'm fairly new to coding in asp and i'm trying to create a simple if..
else... condition
It's for asp web page, and is linked to my database, but i figured
since it's a basic question, it would belong in the General newsgroup.

All i am trying to, is, on my web page I have a table cell, that
feeds off my database.
If there's something in the database in that particular field, then I
want it to be displayed, If not, then rather the cell return a blank
field, I want a picture from another field.

<%
if rsSublisting("Specific_imagelrg") > "" then
Response.write rsSublisting("Specific_imagelrg")
Else
Response.write rsSublisting("Img_lrg")
end if
%>

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #5
Obviously, it doesn't exist in your recordset.
Show us the sql statement used to generate the resultset. Hopefully you are
not using "Select *" - always explicitly list the names of the fields you
wish to retrieve.

Bob Barrows
Raphael Gluck wrote:
Hi,

Thanks for that, I tried it, but it's still not working.
I get the following error,
"Item cannot be found in the collection corresponding to the
requested name or ordinal."

The Item does exist in my database,

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Raphael Gluck wrote:
Hi

I'm fairly new to coding in asp and i'm trying to create a simple
if.. else... condition
It's for asp web page, and is linked to my database, but i figured
since it's a basic question, it would belong in the General
newsgroup.

All i am trying to, is, on my web page I have a table cell, that
feeds off my database.
If there's something in the database in that particular field, then
I want it to be displayed, If not, then rather the cell return a
blank field, I want a picture from another field.

<%
if rsSublisting("Specific_imagelrg") > "" then
Response.write rsSublisting("Specific_imagelrg")
Else
Response.write rsSublisting("Img_lrg")
end if
%>

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: dmbkiwi | last post by:
I am new to this group, and relatively new to python programming, however, have encountered a problem I just cannot solve through reading the documentation, and searching this group on google. I...
27
by: Ron Adam | last post by:
There seems to be a fair amount of discussion concerning flow control enhancements lately. with, do and dowhile, case, etc... So here's my flow control suggestion. ;-) It occurred to me (a...
3
by: Patrice | last post by:
Hi, I need to do multi-conditional statements like below, but this error is displayed : Expected 'End' /myFilepath, line x else response.write(arrCorpo(sparam,sdiv)) end if I don't...
22
by: John | last post by:
Hi Folks, I'm experimenting a little with creating a custom CEdit control so that I can decide on what the user is allowed to type into the control. I started off only allowing floating point...
2
by: juan-manuel.behrendt | last post by:
Hello together, I wrote a script for the engineering software abaqus/CAE. It worked well until I implemented a selection in order to variate the variable "lGwU" through an if elif, else...
1
by: jesmi | last post by:
hi all i have a problem with my code.following is my code: Connection con = null; PreparedStatement stmt = null;
5
by: bigden007 | last post by:
Hi, I have a if..else statement in my script. The statements all execute fine, but the problem is , even if the IF part of the statement is true, the else part executes as well. The verion of...
0
by: =?ISO-8859-1?Q?G=F6ran_Andersson?= | last post by:
MC wrote: No, the problem is not with the compiler, but with the poster. What he describes does not happen, he just invents things like this to troll the newsgroup. -- Göran Andersson
7
by: Peter | last post by:
Hi I have a property (item.Id) which contains a Guid. Based on the value of this Guid I have to execute one of several different tasks. The tasks are really all variations on the theme "obtain...
4
by: maveri4201 | last post by:
I have written a php script (test3.php), which I attached as a text file. Its includes are also attached as text files. I'm trying to run the script here: http://www.wondergy.com/phptestbed/test3.php...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.