Developer

Anatomy of an ASP script

Explore the bones of ASP and find out what holds it together.

By Amy Cowen
(6/29/99)

In HTML, you surround individual tags with brackets, and ASP is not that different. You use the <% %> delimiters in ASP to mark off where a script begins and ends. ASP material can appear anywhere on the HTML page, as long as it sits within the <% %> marks. For this reason, a chunk of ASP code might appear before the HTML tag, or it might appear within an HTML tag. Either way, your ASP and HTML will be tightly integrated.

When you start working with databases, you'll find you can write your HTML once to create a template to control the look and feel of a set of records. Your ASP script will then loop through the database and dump the necessary information onto the page, according to the formatting and structure you've defined in your HTML.

ASP lets you write less code to pull and format information from a database. Plus, the data pulled is always live—as current as the database, at least—so you'll spend far less time editing static HTML pages with onesy-twosy changes to the content.

Primary Language: VBScript
VBScript is the default language for your ASP scripts. If you are using something other than VBScript, you must specify the language. At the top of the page, add this line:

<%@LANGUAGE=ScriptingLanguage%>
VBScript is easy to learn, and once you start working with the syntax and the logic employed, you'll find it increasingly easy to employ. All examples in this article use VBScript.

Editor's Picks