Page 196 - DCAP408_WEB_PROGRAMMING
P. 196
Web Programming
Notes These products can also run on a number of platforms, including
Linux
Sun Solaris
Apple Mac OS
IBM/AIX
Self Assessment
Fill in the blanks:
6. In the right hand pane, a description of the Option Components option appears, as well as
a ............................. labeled start.
7. ASP Pages can run even without ............................. as your Web server.
8. Internet Information Server (IIS) is Microsoft’s professional .............................
7.3 ASP Variables
A Variable is used to Store Information.
If the variable is declared outside a procedure it can be changed by any script in the ASP file.
If the variable is declared inside a procedure, it is created and destroyed every time the procedure
is executed.
Different variables in ASP are mentioned below:
Dim ‘em first
To “Dim” it means to Dimension it. That’s VB lingo. A variable is declared in _VBScript using
the Dim keyword.
<%
Dim myVar
%>
VB programmers will notice here, that we have not included any indication of the type of the
said variable. E.g. Dim myString as String, or Dim myString$.
In _VBScript, all variables are variants. Their type is determined automatically by the runtime
interpreter, and the programmer need not (and should not) bother with them.
By default, _VBScript does not force requiring variable declaration. That is, it is allowed to use
a variable directly without declaring it first. However, experienced programmers know the
importance of making it compulsory to declare all your variables first – without that, the bugs
that may result are very difficult to detect. Considering this, we have here a simple directive to
make variable declaration compulsory.
<%
Option Explicit
Dim myVar
%>
Remember that Option Explicit must necessarily be the first statement of your ASP page,
otherwise a server error is generated.
190 LOVELY PROFESSIONAL UNIVERSITY