This is example for anyone who is just starting ASP. These are easy examples to understand. A live example of this can be found here:
http://www.irideforlife.com/go?x=view
If you like it the please vote!
Terms of Agreement:
By using this article, you agree to the following terms...
You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
You may link to this article from another website, but ONLY if it is not wrapped in a frame.
You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
Note: A comment has a single quote in front of
it. (')
%>
Hello World
If
Statement
<%
If "2"
= "2" Then
Response.write"True"
End if
%>
True
If
...Else
<%
If "2"
= "3" Then
Response.write
"True"
Else
Response.write
"Its
2!"
End if
%>
Its 2!
Request.QueryString
<%
'If
our QueryString matches what we want then we can show what we want
If Request.QueryString("display")
= "message" then
Response.write
"My message"
End if
%>
My message
More
then 1 Request.QueryString
<%
'If
our QueryString matches what we want then we can show what we want
If Request.QueryString("display")
= "test" then
Response.write
"QueryString "test" worked!"
End if
If Request.QueryString("show")
= "test" then
Response.write
"QueryString "test2" worked!"
End if
Note:
' Your linke
will look something like this when clicked:
' default.asp?display=test&show="test"
' & Seperates
QueryStrings in a link.
%>
QueryString test worked!QueryString test2 worked!
Include
file
<%
<!--#include file="myfile.asp"-->
%>
Includes a file into your page. This makes it easy to have a bunch
of code that you use all the time on one page, but yet you don't have
to have a big long page of it. You can also just update the file with
all your code, and then each page that has the include will have the
update as well.
I have some gaps in my asp knowledge and you just plugged one. Thanks and Keep up the good work! (If this comment was disrespectful, please report it.)
Good thanks Ok now 1-how do I pass variables from one page to another (asp) 2 How do you compare bolean values from a databases? ie; <% if rs2(9)= True then%> or <% if rs2.Fields(9).Value = True then %>
both statements are valid but do not catch or understand the bolean value (If this comment was disrespectful, please report it.)
wonderful, someone who can explain script clearly with related examples (If this comment was disrespectful, please report it.)
9/4/2003 4:13:47 AM:
I now feel confident in the basics, I created a page with some of the code above, saved it as a .asp in my site, and then set a link to it. When I click the link, nothing happens! I know that I am missing something - e.g. I have to add HTML formatting or something? Where is the missing link? Thanks for the really straightforward examples. (If this comment was disrespectful, please report it.)
1/31/2005 3:36:16 AM:
That's fine work for begineer Please keep it up! (If this comment was disrespectful, please report it.)
2/26/2005 2:32:16 AM:
hai this codes and way of presentation is good (If this comment was disrespectful, please report it.)
1/3/2007 2:16:04 AM:
Excellent
(If this comment was disrespectful, please report it.)
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)