473,322 Members | 1,690 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,322 software developers and data experts.

"if" statement?


I'm new to asp so this could be an obvious answer. how would I write
and "if-then-else" statement in vbscript for my asp pages?

what I'm doing is pulling data from an access db and displaying it. in
access, my fields that are yes/no fields (checkboxs) show up as true or
false on my page. Is there anyway to turn those true or false
statements into an image?

ie. if -variableX-=true, then display -imageX-, else display -imageY-

any suggestions?

--
gamerman0203
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 5 '05 #1
3 1693
bRet = fRst("fldField_Name")
Select Case bRet
Case True '// Display x
Response.Write "<img src=""someimage.gif"">"
Case Else '// Display y
Response.Write "<img src=""someotherimage.gif"">"
End Select

Or

bRet = fRst("fldField_Name")
If bRet <> True Then '// It's false
Response.Write "<img src=""someotherimage.gif"">"
Else '// It's True
Response.Write "<img src=""someimage.gif"">"
End If

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"gamerman0203" <ga*****************@mail.codecomments.com> wrote in message
news:ga*****************@mail.codecomments.com...

I'm new to asp so this could be an obvious answer. how would I write
and "if-then-else" statement in vbscript for my asp pages?

what I'm doing is pulling data from an access db and displaying it. in
access, my fields that are yes/no fields (checkboxs) show up as true or
false on my page. Is there anyway to turn those true or false
statements into an image?

ie. if -variableX-=true, then display -imageX-, else display -imageY-

any suggestions?

--
gamerman0203
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 5 '05 #2
Steven Burn wrote on 05 nov 2005 in
microsoft.public.inetserver.asp.general:
bRet = fRst("fldField_Name")
Select Case bRet
Case True '// Display x
Response.Write "<img src=""someimage.gif"">"
Case Else '// Display y
Response.Write "<img src=""someotherimage.gif"">"
End Select

Or

bRet = fRst("fldField_Name")
If bRet <> True Then '// It's false
Response.Write "<img src=""someotherimage.gif"">"
Else '// It's True
Response.Write "<img src=""someimage.gif"">"
End If

I would exchange: If bRet <> True Then
with: If Not bRet Then

btw, alternative:

<%
If fRst("fldField_Name") Then z = "" Else z="other"
%>
<img src='some<%=z %>image.gif'>

There are many routes to Rome.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 5 '05 #3
After you've learnt the IF...THEN...ELSE syntax, you'll then have another
question on VBScript....

http://msdn.microsoft.com/library/de...asp?frame=true

Brian
"gamerman0203" <ga*****************@mail.codecomments.com> wrote in message
news:ga*****************@mail.codecomments.com...

I'm new to asp so this could be an obvious answer. how would I write
and "if-then-else" statement in vbscript for my asp pages?

what I'm doing is pulling data from an access db and displaying it. in
access, my fields that are yes/no fields (checkboxs) show up as true or
false on my page. Is there anyway to turn those true or false
statements into an image?

ie. if -variableX-=true, then display -imageX-, else display -imageY-

any suggestions?

--
gamerman0203
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 6 '05 #4

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

Similar topics

9
by: LRW | last post by:
I'm not exactly sure how to even ask the question, and I know my terminology is not good as I'm a SQL beginner, but, here goes. I need to find a way to make an if statement within an array...or,...
9
by: Scott Beavers | last post by:
I'm trying to create a form in Excel to sort from the form and take the data to another worksheet. I am very new to this and any help would be appreciated. I have a value in a cell that will...
3
by: Chris Tilley - HPC:Factor | last post by:
Hi, I'm utterly confounded by this one. There must be some sort of rule that I don't know of. I'd consider myself a Newbie+1, so be gentle. I have a database connection (working A-Ok) and a...
1
by: M Wells | last post by:
Hi All, Just wondering if anyone can tell me if you can test for multiple conditions as part of an "IF" statement in T-SQL in SQL Server 2000? ie something like: IF @merr = 1 or @merr=2...
6
by: JS | last post by:
In this sample code: if(n==0&&args>1){ for(i=num;args>i+1;i++){ s.length = 0; opt = document.createElement('OPTION'); s.appendChild(opt); opt.value = ""; opt.text = "\74-- Vælg --"; }
35
by: David Cleaver | last post by:
Hello all, I was wondering if there were some sort of limitations on the "if" statement? I'm writing a program which needs to check a bunch of conditions all at the same time (basically). And...
32
by: Stephen | last post by:
Is there a standard way to remove the warning that a C compiler might produce from the statement: if (a = b) {} I don't want to do: if ((a = b) != 0) {} Because my "a = b" is actually...
12
by: John | last post by:
I can't get my head around this! I have the following code: <% .... Code for connection to the database ... .... Code for retrieving recordset ... If Not rs.EOF Then ... Do something...
2
by: marsarden | last post by:
write code like: int main(void) { int a=10; if(a<20) {} } Compiler ok on dev-cpp . don't we have to add a ";" after if
6
by: vl106 | last post by:
A static code analysis tool gave me a warning on if (ptr && ptr->data) { ... } I assumed the tool doesn't get the "short circuit behaviour" in the if statement. But a collegue said it may...
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...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.