Advanced Conditional Statement
URLURLI need help writiing an advanced conditional statement.I want to display an image if two recordset values = 1 or other various number combinations.
This statement works with one, how could I edit this statement to include two recordsets values? Say I want to add another feild say "recent" to this statement and it has a value of 2
Code:
<% if Recordset1.Fields.Item("progress").Value = 1 then ' Adv Conditional Region %>
<% end if ' Recordset1.Fields.Item("progress").Value = 1 %>
View Replies
ADVERTISEMENT
I've got the following VB in an ASP page and can't see why it won't work
<% if Request.QueryString(Failed=="N")%> The Failed variable is N <% else
%>The failed variable is not N<% end if %>
I'm calling the page as thepage.asp?Failed=N
View Replies
View Related
I have a code for executing a stored procedure and returning a recordset wrapped in an IF statement. If the statement is true the code executes. If the statement is false the code is skipped.
On the page, I want to display a message if the Recordset returned from the stored procedure is empty.
<% If rs.BOF or rs.EOF Then %>
Message
<% End If %>
Running the above code will return an error message if the recordset object doesn't exist...i.e. if the stored procedure hasn't executed and returned the recordset object.
How can I write the code to include that condition?
View Replies
View Related
Given a value in a database (Access) of type Currency how do I write a conditional statement such as the following:
if rs("price") > "$1,000,000" Then
Response.Write " Luxury Home"
End If
When I try this it writes out Luxury Home for every record, regardless of the value in Price.
View Replies
View Related
I'm just trying to figure out what the colon : does in this code:
<%If (Not isNull(COLOR)) Then If (COLOR = "Blue") Then Response.Write("SELECTED") : Response.Write("")
I thought it may be the ASP version of the Ternary operator, but it doesn't have the same effect. Is it just another way to concatenate? or a reverse concatenate?
or maybe a addition of an empty string to make sure that the output from the response.write statement is a string and not a number?
If the second response statement has a value then it prints it e.g. Code:
View Replies
View Related
know what an if statement is, and dont' find that challenging. However what the heck does this mean in ASP? Code:
if sFileName <> "" THEN
Does it mean if sFileName is not empty then do the following?
View Replies
View Related
I am trying to do a simple "less than" conditional statement, and hitting a brick wall if I use a database element with it.
This DOES work:
<%
if Request.QueryString("PC") < 10 then Response.Write("less than ten") else
Response.Write("more than or equal to ten") End if
%>
This DOES NOT work:
<%
if Request.QueryString("PC") < Record.Fields.Item("count(*)").Value then
Response.Write("less than COUNT") else Response.Write("less than or equal to
count") End if
%
View Replies
View Related
my company is in need of a shoppingcart that has adavanced inventory management in the admin, i.e. calculates 'cost of goods sold' in reports and FIFO etc. Anyone know of any?
View Replies
View Related
Is there any resources (code, samples, snippets, methods etc) anyone knows of creating an advanced search in ASP linked to a microsoft Access 2000 database?
I basically want to query a database from attributes stored, e.g male, height etc using radio buttons and a text input form.Im using Dreamweaver MX and a DSN.
View Replies
View Related
I already have the code which does simple paging [First] [Prev] [Next] [Last] . how to achieve the [...] feature?? That is if there are 1000 pages, I don't want to display the page link for all the 1000 links in one go. I want only the first 10 page links to be shown on one page then display [...] for the user to click and see the next 10 page links.
I have been searching for this feature for a long time but most of them talks about the simple paging only. Useful links and complete source codes.
View Replies
View Related
I have had a project on my plate for months with noone who knew CDONTS enough to help. I do not believe there is anyone better to ask than you. Here's my problem. I use CDONTS on 2-2k servers with the basic SMTP server included with IIS. Because of the corporate firewall I am unable to use this method to send email to an external email account.
What I need to do it use CDO 1.2 and attach to an outlook application on the server which has access outside our network. My problem is every tutorial I find seems to be wrong and noone seems to know how to make this happen.
View Replies
View Related
Advanced DHTML Dropdown List component (Javascript,ASP,.NET,PHP)
enhances usability of large dropdown lists with type & select feature.
It suggests possible matches for entries you type in the input box.
View Replies
View Related
I'm trying to create a search on my asp form that will ingnore spaces, and, or and replace them with % for a wild card search. now if they type in the box Go Home it will only find Go Home. Right now I'm just trying to get it to take that Go Home and put it in Go%home.This is what I'm using for this field.
pcat = GetParam("category")
if not isEmpty(pcat) then
if not (sWhere = "") then sWhere = sWhere & " and "
HasParam = true
sWhere = sWhere & "e.category like '%" & replace(pcat, "'", "''") & "%'"
end if
Everything i've tried doesn't seam to work.
View Replies
View Related
I need some help with creating an MS Access table using ASP. I'm familiar with "standard" SQL statements, and also with the ASP methodology/syntax for creating a simple MS Access table. However, the table I need to create is a bit complicated, because:
The primary key is a FORMATTED auto number (i.e., if I were to define this field directly in MS Access' "Table Design View", I would put "Acme-"000 in the FORMAT field to create an autonumber that automatically generated a series like Acme-001, Acme-002, Acme-003, etc.)
The first part of this formatted autonumber is a variable. So, with this in mind, how do I write an ASP statement to create a table that has an autonumber field as a PRIMARY KEY, formatted per the above?
View Replies
View Related
What I want to do, is in my admin page, where I have all the users details, I want to be able to see when they last logged in, how many times they've logged in, and which user's are currently online? Just so that it can be used for reference, and also as a sort of extra security.
Also, is there any way that I can make the login more secure? At the moment, it only uses Sessions, is there anything else I could do to make it more secure?
View Replies
View Related
May I boldy suggest that a new advanced ASP forum is created (ideally within the "Advanced Development Center", but otherwise as a sub-forum of this forum) for ASP questions and discussions which are more challenging/complicated than the norm? Code:
View Replies
View Related
Imagine you have a databse memo object with the description of a town.
Imagine if you wanted a peaceful town, you might type "peaceful" in a text
box and then click submit, the query run will be:
WHERE towndesc LIKE '*" & Text32 & "*'
Now imagine if they type "peaceful trees"
How do you get it to automatically check:
WHERE towndesc LIKE '*peaceful*' AND towndesc LIKE '*trees*'
Because it can have one description or the user can enter 5.
Or maybe you want the user to be able to enter key words like AND OR
and use them within the query.
View Replies
View Related
I am trying to debug an issue with sessions in my ASP 3.0 web
application, which runs fine on WIN2K Pro and WINXP Pro, yet fails to
function correctly on WIN2K Advanced Server.
My actual application is using sessions to store username, and security
level (permissions) for my application. The default.asp page is the login,
where these values are set. I have triple and quadruple checked my IIS
Settings to make sure "Enable Session State" is checked, and the
session.timeout is set to 120.
Now if I remove my application, recreate it
in IIS admin, stop and start the IIS services, and run my application, the
session variables seem to be saved across the first redirect to my
main_menu.asp page. Here I have several menu choices, which are dependent
on the session("seclevel") to determine which they can or cannot access.
Here is where it seems my session vars are lost, since when I click on any
choice, I get redirected to the log_out.asp page, which abandons the session
and returns the user to the login (default.asp) page. Code:
View Replies
View Related
if there is a way to validate email addresses further. For example I just received an email from this person:-
cvx@fcxgf.fgfd
Obviously some fool trying to f**k with my form and send me a test email.
Because an array of countries have different extentions, can I not somehow validate for that?
I guess my validation is picking up on the @ symbol and the fact that some chars are needed before and after the @ symbol and a dot exists. But can we validate this further to prevent me getting this kind of email?
View Replies
View Related
I have a form with a list/menu where you select the year you were born. Now, when I submit this form, it creates a new register in my database etc.
How can I use a conditional to redirect a person that for example was born in 1987 or less?
if request.form("year")="1987" then%> is this the correct way to start?
View Replies
View Related
I have a ton of dynamic pages that I need an asp conditional to run on.I know the urls of all the pages and I want to know if there is an easy way to write a conditional statement that if they are on a specific page that it outputs something depending on the url they are on. Is there an easy way to do this?
View Replies
View Related
I have the following simple conditional on my page,
If EmpIDError <> 1 Then
'Show Input items
End If
Now I need to add another conditional to this,
If PosIDError <> 1 Then
'Show input items
End If
So I made it like this,
If EmpIDError <> 1 OR PosIDError <> 1 Then
But the problem is that if PosIDError = 1, then it still shows the input
items. But if I take the EmpIDError <> 1 out then it works with no
problems. Why would this be like this?
View Replies
View Related
Can anybody point me to a good tutorial/manual on advanced server-side form validation including validation of fields against unwanted strings such as the use of "http://".
View Replies
View Related
I have written a small library for ASP, and I tried to keep it in a modular fashion, splitting my library in some files.
Then I have a file named "framework.asp" that include all the other files.
The problem is that I can't reuse code internally to my library because if for example:
framwork.asp include:
- utils.asp
-html.asp
Then html.asp include:
-utils.asp
If the programmer include framework.asp would have 2 times the same file utils.asp in his ASP page! Code:
View Replies
View Related
Will this work in asp 3.0:
If True Then
<!-- #include file="test1.asp" -->
Else
<!-- #include file="test2.asp" -->
End If
View Replies
View Related
i have an simple invoice sheet and in "total" coloumn i need to put a formula like IF < 8.50 THEN VALUE =8.50.it is something like we dont do delivery less then 8.50 so if the TOTAL is less than 8.50 then it should turn in to 8.50 automatically.
View Replies
View Related
One of my asp pages can be loaded in two ways - it may be submitted to itself (and therefore contains user data) or it can be loaded by clicking on a link on my menu, and consequently all fields are empty.
If the fields contain values (ie. the submit button was pressed), i want to load data from my database into an array, but if it is accessed via a link, i don't want this data to be loaded. So essentially, i want to know if there is some form of conditional compilation or something in asp (i know it technically shouldn't be called that, but i'm coming from a c++ background, so...) similar to the #if and #elif type directives in C
I can't place the code in a subprogram and selectively call it, because I want the arrays to be global so all my client-side scripts can access the data I'm using VBScript for the asp scripting.
View Replies
View Related
I have a shopping cart that I want to load items in that come from a huge scrolling form. In other words, when someone clicks on a category in our site, it scrolls out all the items in that category, maybe 30 or more. I have text boxes next to each item so somone can enter a number, then press submit form button at the bottom of the form, and
send those slections to the shopping cart.
The problem is, many of the text boxes are empty, yet they are still being sent to the shopping cart as a quatity of 0. Is there a way for sql to ignore a value if the variable is zero, or only get the sql statement to run if a variable is > 0?
View Replies
View Related
I am not too sure wats wrong w the if-else statement below!
<%if(grp==grp2)%>
{
<%if (start==req || end==req)%>
{
<%=grp%>
<%=start%>
<%=end%>
}
<%else%>
{
<%="There is no such record found"%>
}
}
<%else%>
{
<%="There is no such record found!"%>
}
<%endif%>
Error: 'else' without 'if'.
else
^
View Replies
View Related
displays content IF several conditions exist or display's nothing if it doesn't?
Basically, in english this is what I'm trying to do:
IF a record exists
WHERE session(userID) = idByUserID in 'notes'
AND
WHERE userID = idAboutUserID in 'notes'
THEN
display from the record fieldnames 'LastUpdate' and 'note'
ELSE
don't display anything
View Replies
View Related
I have a 'primary' intranet website and a 'secondary' backup of this site as
well. I would like to programmatically have the effect that if the
primary site is (page not found 404) not available, for it to access the
secondary site or at least be able to add a message with (or instead of) the
404 error dialog that the primary site is down and give the user a link to
the alternative (secondary) site.
View Replies
View Related
Ok I know this is simple but I cannot get it to work.
on the URL I have:
.../default.asp?strCode=xxx
I then have:
If Request.QueryString("strCode") = "xxx" Then
Response.Write "code is XXX"
End If
So for some reason it is not evaluating the queryString and does not enter into the conditional. Why?
View Replies
View Related
I'm trying to not show some data dependant on date but it never works right.
<% If Request.QueryString("EventDate") > DateAdd("d",6,Date()) Then %>
I have used similar routines before and it worked fine but this time i'm using a QueryString instead of a database field.
View Replies
View Related