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

If statement when retrieving variable from database

I have code that looks like this (pulling in 3 fields from a sql database), but I want it to only show the fields if <%=rs("UnitPrice3")%> is greater than 0. How do I write the if statement on my asp page?

Expand|Select|Wrap|Line Numbers
  1. <div class="orderItem">
  2. <a href="http://www.xyz.com/eshop/shop.asp?productcode=<%=rs("ProductCode3")%>" title="Order"><img src="http://bytes.com/images/order.gif" alt="Order" /></a>
  3.                    <span>$<%=rs("UnitPrice3")%></span>
  4.                    <%=rs("ProductName3")%>
  5. </div>
  6.  
I've attached an image of what I get without the IF statement - I don't want to see the order button or the $ if the unit price is <0.

Thanks for any help.
Attached Images
File Type: jpg unitprice.jpg (880 Bytes, 225 views)
Sep 17 '10 #1
2 1693
jhardman
3,406 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. <div class="orderItem">
  2. <%
  3. if rs("unitprice3") > 0 then %>
  4.    <a href="http://www.xyz.com/eshop/shop.asp?productcode=<%=rs("ProductCode3")%>" title="Order"><img src="http://bytes.com/images/order.gif" alt="Order" /></a>
  5.                       <span>$<%=rs("UnitPrice3")%></span>
  6. <%
  7. end if %>
  8.                    <%=rs("ProductName3")%>
  9. </div>
  10.  
Is this what you are looking for?

Jared
Sep 17 '10 #2
Yes - thank you! That worked.
Sep 17 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: eddie wang | last post by:
Hi, I restored a database 2 months ago. After the restore, I lost all my "users" for that database. It has been a while, so I don't remember the detail of what I did. How can I reserve all the...
1
by: Victor | last post by:
I'm retrieving values from the textboxes that I created dynamically. However I get commas appended to my text values and just a comma wherever the textbox is empty. Dont know what is causing this....
10
by: jeff regoord | last post by:
A user inputs a float value. The scanf() function gets the value. However, I need to create an error handler with an if else statement saying invalid input if the input is not a number. Does...
2
by: RSH | last post by:
I am struggling a bit trying to get at all of the Table names in a given Access database. I have the code below which should be retrieving the information...i am just having a bit of trouble...
3
by: Jakob Petersen | last post by:
Hi, I need to increase the speed when retrieving data from a hosted SQL Server into VBA. I'm using simple SELECT statements. How important is the speed of my Internet connection? (I have...
5
by: djhexx | last post by:
Hello. I have an ASP.NET application (C#) that I allow users to upload files. Files get stored in a SQL2005 database. The file data is stored in a varbinary(max) column. When the user uploads...
0
mafaisal
by: mafaisal | last post by:
Hi Everybody I am Using Vb.net 2005 My Error when i Retrieve imge file from sql2005 database parameter not valid error is coming my code is Dim Logo As Byte() = RsC.Fields("Logo").Value
2
mafaisal
by: mafaisal | last post by:
Hi Everybody I am Using Vb.net 2005 My Error when i Retrieve imge file from sql2005 database my code is Dim Logo As Byte() = RsC.Fields("Logo").Value Dim stream As System.IO.MemoryStream
1
by: harry4you | last post by:
When retrieving the data from DB2 through Excel do we need to catalog the databases. I am currently using ODBC DSN less connection to connect.
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.