ASP Best Practices

Next Topic

Layout Order

<%@ LANGUAGE=VBScript %>
<% Option Explicit %>

  <HTML> 
    <HEAD> 
      <TITLE>Variable Sample</TITLE> 
    </HEAD> 

    <BODY BGCOLOR="White" topmargin="10" leftmargin="10"> 

      <!-- Display Header --> 

      <FONT SIZE="4" FACE="Arial, Helvetica"> <B>Variable Sample</B></FONT> 
      <BR> 

      <HR> 

      <H3>Integer Manipulation</H3> 

    <% 
      'Declare variable. 
      Dim intVariable 

      'Assign the variable an integer value. 
      intVariable = 5 
    %>

.
.
.

For VBScript, use Option Explicit to force explicit variable declaration. This prevents misspelled variables from causing unexpected results when the script executes.

To declare a transactional page, add the <%@ TRANSACTION=value %> directive to the first line on the page.