Solved

ASP code to display region if result is <> '0'

Posted on 2014-10-14
3
157 Views
Last Modified: 2014-10-14
I am displaying a total (money) if the recordset returns a record, otherwise it displays an error, the problem is that the result is being formatted as currency and if the result is '0' it displays an error  :$

this is my code:

  <% if (!TotalAvailable.EOF || !TotalAvailable.BOF) { %>
              <%= DoCurrency((TotalAvailable.Fields.Item("TotalAvailable").Value), 2, -2, -2, -2) %>
              <% } // end !TotalAvailable.EOF || !TotalAvailable.BOF %>


How can I change my IF statement so that it only displays also if the result is <> 0 ?

Aleks
0
Comment
Question by:amucinobluedot
  • 2
3 Comments
 
LVL 32

Expert Comment

by:Big Monty
ID: 40379742
Try this

<% if (!TotalAvailable.EOF || !TotalAvailable.BOF && TotalAvailable.Fields.Item("TotalAvailable").Value != 0 ) { %>
0
 
LVL 32

Accepted Solution

by:
Big Monty earned 500 total points
ID: 40379819
actually, this is a better way to do it:

 <% if (!TotalAvailable.EOF || !TotalAvailable.BOF) { 
              if( TotalAvailable.Fields.Item("TotalAvailable").Value != 0 )           %>
                      <%= DoCurrency((TotalAvailable.Fields.Item("TotalAvailable").Value), 2, -2, -2, -2) %>
 <% } // end !TotalAvailable.EOF || !TotalAvailable.BOF %>

Open in new window


this way, it'll only check for the zero value IF there are records returned
0
 

Author Closing Comment

by:amucinobluedot
ID: 40380013
Thx !
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Form submit issue 11 80
FTP File permissions 1 45
File Upload Control on a ASP.NET Overlay Page 1 42
What .NET URL re-routing tool did I use? 2 36
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now