Learn about Basic ASP Variables (7 ASP):

7 asp

As we all know that variable is used to store information. There are different types of variables in ASP.

Something about Variable’s Lifetime:

Those variables which are declared outside the procedure can be easily changed or accessed by using any script in ASP. But those variables which are declared inside the procedure cannot be changed or accessed by any scripts. Because they are created and destroyed every time a procedure is executed.  The main two types of Variables are:

 

Session Variables:


Those variables which store information of only single user but they are available on all the pages in a single application are known as Session Variables. Mostly the type of information stored in these variables is: name, id and preferences.

 

Application Variables:

These variables are also available to all the pages in the application. But they are used to store information of many, in fact, all the users in one particular application.

 

How to declare a text value variable:

Following is an easy example to show how to store a text as a value in the variable:

Example:

<html>

<body>

<%

Dim name

Name=”Tweety”

response.write(“My name is” & name)

%>

</body>

</html>

 

RESULT:

My name is Tweety

 

How to declare a array:

Following is an easy example to show how to store a text as a array:

Example:

<html>

<body>

<%

Dim framename(6),m

Framename(0) = “tweety”

Framename(1) = “sweeto”

Framename(2) = “dan brown”

Framename(4) = “angel”

Framename(5) = “ben ten”

Framename(6) = “lara croft”

For m = 0 to 6

response.write(framename(m) & <br/>)

Next

%>

</body>

</html>

 

RESULT:

tweety

sweeto

dan brown

angel

ben ten

lara croft

 

For more visit next posts in this category.To go back to Contents of this tutorial: ASP Active Server Side Scripting Contents

email

2 Responses to Learn about Basic ASP Variables (7 ASP):

  1. gry online says:

    Nice site you are running there. And many thanks for sharing this.

  2. Sup , I am making a new website almost the same as ehow and some of your original articles would fit the style good. Would I be able to link back to this article?

Leave a Reply