Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1
As you can see, the anatomy of an Active Server Page is not very different from a regular Web page.
The only difference is the code that is between the <% %> tags. This code is executed on the server and
not on the client. This means that this code actually happens before the page is ever sent to the
browser. The actual output looks like Figure 13.10. If you were to view the source of the output of the
final page, you would see the following:
<HEAD>
</HEAD>


<P align=center><FONT size=5><STRONG>Thank You For Signing
Our Guest Book. </STRONG></FONT></P>
<P align=center><FONT size=5><STRONG>Come Back Real
Soon!!</STRONG></FONT></P>



Figure 13.10 The output of GuestBook.asp.
Notice that the code between the <% %> tags has disappeared. This is no error, the code was executed
on the server and never sent to the client. You can do a lot of things here. You can actually generate a
page dynamically from the contents of a database with Active Server Pages. This will be covered a little
later today.


Working with VBScript


Now that you have a general idea of what an Active Server Page is and how it is used, Look more closely at
the code that appears between the <% %> tags. The code used in Active Server Pages is VBScript. VBScript
is a subset of the Visual Basic programming language. VBScript is very easy to use because it uses the
same syntax as Visual Basic. It also has the flexibility of Visual Basic. The Visual Basic language scripting
edition retains the best of Visual Basic, such as error handling and string formatting. Also, like Visual Basic,
VBScript is easy to use.
Note VBScript in not the only scripting language used in Active Server Pages. Others
include JScript, LotusScript, and PerlScript.
There are many books dedicated to VBScript and Active Server Pages, you should read one of those if
you would like to learn more. This book will only cover the basics—enough to introduce you to the
concepts and some of the syntax and how you can use it to connect to a MySQL database. For a more
detailed account, read Active Server Pages Unleashed by Sams Publishing.

Free download pdf