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

(singke) #1

Commenting Your Code


You can also use comments in your server pages. A comment is denoted by a single quote ('). There are no
block comments in VBScript. If your comment spans multiple lines, you must include a single quote at the
front of every line.


' This is a single line comment.

' This
' is
' a
' multiple line
' comment

Another feature of VBScript that you can take advantage of is its built-in functions. VBScript supports
many of the same functions in Visual Basic.

Generating a Web Page with VBScript


Now you'll look at a VBScript example that demonstrates what you have learned so far. The code segment in
Listing 13.2 shows how VBScript, when used in an Active Server Page, can generate a Web page that takes
values from a MySQL database and displays them in a Web page. The Web page is shown in Figure 13.11.
Note that the line numbers appear only as a reference—they should not appear in your code.


Figure 13.11 A Web page generated using VBScript with Active Server Pages.
Listing 13.2 Generating a Web Page


10 <%@ Language=VBScript %>


20


30


40


50


60 <%


70 ' Variable Declaration


80 Dim rstCustomers 'ADO Recordset


90 Dim mConn 'ADO Connection


100 Dim mCmd 'ADO Command

Free download pdf