Active Server Pages Bible

Overview

Everything you need to build dynamic Web sites with Active Server Pages is included in this comprehensive programming reference. Step-by-step tutorials and code examples from expert developer Eric Smith enable you to program and combine Web site applications to meet your specialized needs. With easy-to-follow steps and clear examples, Active Server Pages Bible is your key to unlocking the world of ASP by ...
See more details below
Paperback
$37.40
BN.com price
(Save 37%)$60.00 List Price
Other sellers (Paperback)
  • All (18) from $1.99   
  • Used (18) from $1.99   
Sending request ...

Overview

Everything you need to build dynamic Web sites with Active Server Pages is included in this comprehensive programming reference. Step-by-step tutorials and code examples from expert developer Eric Smith enable you to program and combine Web site applications to meet your specialized needs. With easy-to-follow steps and clear examples, Active Server Pages Bible is your key to unlocking the world of ASP by presenting the following topics:
* The essentials you need to better understand how ASP works with HTML
* Concepts of the VBScript language
* Web programming and how it differs from traditional client/server computing
* Integrating client/server computing with an ASP engine and making the most of its features
* Building commonly used applications that make it easier to publish data from a database
* Integrating ASP with other components, libraries, and tools like Index Server, Visual Basic, and Microsoft Transaction Server
* Developing an idea from concept to application
As an added feature, many of the topics discussed in Active Server Pages Bible are cross-referenced to other parts of the book or external Web sites to maximize your understanding of the material.
Read More Show Less

Product Details

  • ISBN-13: 9780764545993
  • Publisher: Wiley
  • Publication date: 12/14/1999
  • Series: Bible Series , #166
  • Edition number: 1
  • Pages: 792
  • Product dimensions: 9.25 (w) x 7.50 (h) x 1.55 (d)

Meet the Author

About the Author Eric A. Smith is an independent consultant who lives in the Washington, D.C. area. He is a Microsoft Certified Solution Developer and works extensively in both Web and traditional client/server environments. He has written, edited, or contributed to eight books in the Visual Basic and Web markets. Mr. Smith is also the owner of both the VB Techniques Web site (http://vbtechniques.com) and the ASP Techniques Web site (http://asptechniques.com). These sites are used to provide "service after the sale" to his readers. You can get updated code and related articles for all of his books at these sites. He is also the creator of inquiry.com's Ask the VB Pro site, now part of Fawcette Technical Publications. Mr. Smith is active at his church and is a volunteer Emergency Medical Technician for the Fairfax County Fire and Rescue Department. If you'd like to contact him with questions about the book, you can reach him via e-mail at aspbib1e@ asptechniques.com.
Read More Show Less

Read an Excerpt

Chapter 1: HTML Essentials

As mentioned in the introduction, HTML works hand in hand with Active Server Page (ASP) technology. ASP code can be used to generate HTML, which is what eventually finds its way to the user's browser. As a result, this chapter is devoted to HTML. While the chapter doesn't cover all the tags used in HTML, it does cover some of the tags used throughout the rest of the book. At the end of the chapter, there is a list of good books that can serve as HTML reference guides.

Document Structure Elements

Because ASP files normally have output, they need to generate standard HTML. Let's start with the standard HTML page structure, as follows:

<html>
<head>
     <title>Page Title</title>
</head>
<body>
 
</body>
</html>
Note: While some browsers still show the contents of the page if you are missing these standard tags, you should provide all the tags in every page that generates output. In following chapters, you see how you can use these tags to provide additional information to the user. For instance, you can dynamicallygenerate an appropriate TITLE tag for the page you are creating.

HTML tag

The HTML tag is used to mark the beginning of a page. This tag should be the first tag sent to the user's browser. As discussed in following chapters, this rule doesn't mean that the HTML tag is the first tag in the file. In some cases a lot of code is required before a single piece of HTML is sent to the browser. The end /HTML tag should be the last tag sent to the user's browser. Again, you may have ASP code that follows the last HTML tag, but /HTML should be the last tag sent to the browser.

HEAD tag

The HEAD tag is the second level of tags in a page. This tag is used to contain page header information, such as the title of the page. Other tags, like the META tag, can also go into the heading section. The heading needs to be closed before using the BODY tag, as covered in the following "BODY Tag" section. The heading is treated as a separate section of the document and should not be enclosed by the BODY tag.

TITLE tag

The TITLE tag provides the title of the page. This title shows up in numerous places in the user's browser, such as the title bar of the browser window and in the user's browsing history list. The title can be printed on as many lines as you wish, and the end of the title is marked by /TITLE.

BODY tag

The BODY tag marks the beginning of the content of the page. All of the remaining HTML in the page follows this tag. At the end of the file, the /BODY tag ends the content for the page. The BODY tag has a number of optional parameters that can be used to customize the look of the page. The most commonly used parameters are shown in Table 1-1.

Table 1-1: Common BODY Tag Parameters
Parameter Name Description
BACKGROUND Specifies an image to repeat as the background of the page
BGCOLOR Specifies a color to use as the background for the page
TEXT Specifies the color to use as the default color for text
ALINK Specifies the color to use for a link being clicked (Netscape only)
LINK Specifies the color to use for a link that has not been clicked
VLINK Specifies the color to use for a link that has been clicked

Text Formatting

Since HTML has become a standard language, both Microsoft and Netscape have introduced many extra tags that were not in the official specification for HTML. Unfortunately, neither company implemented all of these extra tags. As a result, if you want your text to be formatted in a similar manner in both browsers, you have to avoid both sets of extra tags.

Fortunately, most HTML authors take this approach, and many of the tags in the specification have been forgotten. This section shows you the most commonly used text formatting tags and introduces a few extras that might be unfamiliar. If the tag is not available in both Microsoft and Netscape's browser, it is not listed here.

Note: For those using other browsers, be aware that the tags covered in this section are part of the official HTML specification and should be supported in your browser. However, because Microsoft and Netscape control an overwhelming majority of the browser market, we won't be spending our time with the other browsers that are still available.

Headings

One of the earliest additions to HTML was the ability to have different levels of headings, just as you would have in an outline. The heading tags are used for this purpose. There are six levels of headings and each level has its own tag pair. Each tag pair is the letter H followed by a number from 1 to 6. Figure 1-1 demonstrates all six sizes for easy comparison. The source code for the picture is in Listing 1-1, which follows the figure.

Listing 1-1: Source code for Figure 1-1


<html>
<head>
<title>Heading Tag Demonstration</title>
</head>
<body>
<h1>This is Heading 1 (H1) Font</h1>
<h2>This is Heading 2 (H2) Font</h2>
<h3>This is Heading 3 (H3) Font</h3>
<h4>This is Heading 4 (H4) Font</h4>
<h5>This is Heading 5 (H5) Font</h5>
<h6>This is Heading 6 (H6) Font</h6>
</body>
</html>

Figure 1-1: Six levels of headings, as seen in Internet Explorer

Notice that when the closing heading tag is used, it automatically adds a line break and adds some extra space between the lines.

One of the basic problems with the heading tags is that you have little control over the appearance of your text in the user's browser. For instance, the browser in Figure 1-1 defaults to Times New Roman font and there is no way to change it using just the heading tags. In addition, the sizes of the fonts are all relative and can be changed by the user. In Internet Explorer, the base font size can be changed by selecting View , Fonts and then picking the base size. Netscape has a similar function in its Preference window.

For comparison, Figure 1-1 shows the fonts in Medium mode. Figure 1-2 shows the text in Largest mode, and Figure 1-3 shows the text in Smallest mode.

Don't despair, however. A technology called Cascading Style Sheets (CSS) makes it possible to redefine these heading styles to include font names, sizes, colors, and so forth. Check the list of books at the end of this chapter for more information on CSS.

Figure 1-2: Text shown in Largest font size in IE

Figure 1-3: Text shown in Smallest font size in IE

BLOCKQUOTE tag

The BLOCKQUOTE tag marks a section of text as a quote from another source. The text is indented on both the left and right side. An example of the tag is shown in Figure 1-4.

Figure 1-4: Text within the BLOCKQUOTE tag is indented on both sides.

PRE tag

The PRE tag shows text in a monospace font. PRE is short for preformatted. Any text surrounded with the PRE tag pair will be shown exactly as it appears in the source file. Figure 1-5 shows an example of preformatted text as rendered by the browser. Listing 1-2 shows the source code for this example.

Listing 1-2: Preformatted text example in Figure 1-5

<html>
<head>
<title>Preformatted Text Example</title>
</head>
 
<body>
 
This text is on
multiple lines
in the file but will
be automatically wrapped
in the browser.
 
<pre>
Text inside of the PRE
tags will show exactly
as it is in the file.
</pre>
</body>
</html>

Figure 1-5: Preformatted text, as shown in the browser

One problem with the PRE tag, as shown in Figure 1-5, is that it automatically adds a line break and extra space. If you need to include code in the same line, use the CODE tag, which is covered in the following section.

CODE tag

Like the PRE tag, the CODE tag shows text in a monospace font. However, it does not add a line break before and after the text. Figure 1-6 shows a comparison between the two methods, and Listing 1-3 shows the source code for the window.

Figure 1-6: CODE vs. PRE comparison

Listing 1-3: Source code for CODE vs. PRE comparison in Figure 1-6

<html>
<head>
<title>CODE vs. PRE Example</title>
</head>
 
<body>
The <code>CODE</code> tag shown here is in monospace font.
 
If the <code>PRE</code> tag was used instead, the text would look like this:
 
The <pre>CODE</pre> tag shown here is in monospace font.
 
</body>
</html>

In short, if you want to show a block of text, use the PRE tag. If you need to emphasize a term in the same sentence, use the CODE tag.

FONT tag

One of the more flexible text-formatting tags is the FONT tag. A number of parameters can be supplied to change the look of the text. The most commonly used parameters are listed in Table 1-2.

Table 1-2: FONT Tag Parameters
Parameter Description
COLOR Specifies the color in which the text should be displayed
FACE Specifies the font name to use
SIZE Specifies the relative size to use for the text

The FACE parameter can list multiple fonts, separated by commas. If you are using a font specific to a particular machine, be sure you specify a similar font as the second font in the tag. For instance, Tahoma is a font normally available with Windows. However, Tahoma is not normally available on other platforms. A good use of the FACE parameter follows:

<font face="Tahoma, Arial, Helvetica">

If the Tahoma font is not available, the browser looks for Arial. If Arial isn't available, it looks for Helvetica. If Helvetica is also missing, the browser reverts to the default font for the browser.

The SIZE parameter does not allow exact pixel or point sizes; rather, it uses relative values. You can specify values using two different methods. The first uses an absolute value of 1 through 7, as follows:

<font face="Arial" size=3>

You can also specify a change in font size using the values ­4, ­3, ­2, ­1, +1, +2, and +3.

Miscellaneous Formatting Tags

Several other tags can provide quick formatting for your HTML. These tags are shown in Table 1-3.

Table 1-3: Formatting Tags
Tag Description
B Boldface text
I Italic text
S Strikethrough text
U Underlined text

A quick example of boldfacing text follows:

<b>This text will be shown in boldface text.</b>

You can follow this model for all of the tags shown in Table 1-3. Remember to close the tag pair or you could get unexpected formatting results.

Positioning Tags

A number of tags position text and graphics on Web pages. These tags can be used within any of the tags covered in this chapter. Depending on the browser you're using, these tags can produce different results.

CENTER tag

This tag is used to center text between the sides of the browser window -- if the text is not within another tag, such as a table. If the text is within another tag, the text will be centered within the relevant area. Any text that is centered should be between the CENTER tag pair, as follows:

<center>This text is centered.</center>
This text will not be centered.

Paragraph tag
The P tag is one of the most commonly used tags, but it isn't normally used as shown in the HTML specification. Many users simply add a P tag to add a break between paragraphs, as follows:

This text is in paragraph 1.
<P>
This text is in paragraph 2.

The specification uses an ending paragraph tag, as follows:
<P>
This text is in paragraph 1.
</P>
<P>
This text is in paragraph 2.
</P>

Because the second example follows the specification, you should use that format instead of the first example. While browsers will probably always support the first method, the second format has an extra option unavailable in the first. You can add the ALIGN parameter and specify LEFT, RIGHT, or CENTER. An example of the ALIGN parameter follows:

<CENTER>
This text is centered.
</CENTER>
 
<P ALIGN=CENTER>
This text is also centered.
</P>

BR tag

The BR tag puts a line break between two lines of text. The tag behaves the same as hitting your Enter key. BR won't put extra space between the lines, however, as with the paragraph tag. The BR tag does not need a closing tag. Simply use it as follows:

This is line 1.<br>
This is line 2.<br>

HR tag

HR stands for horizontal rule, which is a horizontal bar that can appear on a page. A simple use of this tag is shown in Figure 1-7, and the code is shown in Listing 1-4.

Figure 1-7: Use of horizontal rule on a page

Listing 1-4: Code for what is shown in Figure 1-7

<html>
<head>
<title>Preformatted Text Example</title>
</head>
 
<body>
 
This is text on top of the horizontal rule.
<hr>
This is text on the bottom of the horizontal rule.
 
</body>
</html>

This tag has a number of additional parameters that can be used to change the appearance of the bar. Table 1-4 lists these parameters.

Table 1-4: HR Tag Parameters
Parameter Description
SIZE Specifies the thickness of the bar
WIDTH Specifies the width of the bar in either pixels or as a percentage
ALIGN Indicates how the bar should be placed on the page (left, center, right)
NOSHADE Removes the shadow that normally appears below the bar
COLOR Specifies the color of the bar; if omitted, the default is a dark gray

List Tags

You can create three different lists in HTML. Each of the lists has a slightly different format and can be used for different purposes. This section shows how these lists are created.

Unordered List

Unordered lists will probably be the list you use most often. This type of list is also known as a bulleted list, because all of the items are shown following some sort of dot or other bullet. An unordered list uses the UL tag, as shown in the following example:

<html>
<head>
<title>List Sample</title>
</head>
 
<body>
 
<ul>
<li>This is item 1.
<li>This is item 2.
<li>This is item 3.
</ul>
 
</body>
</html>

When loaded into the browser, this code produces the page shown in Figure 1-8.

Figure 1-8: Unordered lists display with bullets

You can also have a list within a list. As shown in Figure 1-9, the sublist uses a different bullet than the primary list.

Figure 1-9: A sublist within a list

The code for the previous figure is shown in Listing 1-5. No special tags are needed, because the browser determines that the list is within another list.

Listing 1-5: Source code that has a list within another list (Figure 1-9)

<html>
<head>
<title>List Sample</title>
</head>
 
<body>
 
<ul>
<li>This is item 1.
<li>This is item 2.
<li>This is a sublist:
<ul>
<li>subitem 1
<li>subitem 2
<li>subitem 3
</ul>
<li>This is item 3.
</ul>
 
</body>
</html>

You can nest any of the lists covered in this section, and you can also mix and match list types.

Ordered List

The ordered list uses cardinal numbers instead of bullets. Listing 1-6 would be rendered as Figure 1-10 if the ordered list tag (OL) was used instead.

Listing 1-6: Source code for ordered lists example (Figure 1-10)

<html>
<head>
<title>List Sample</title>
</head>
 
<body>
 
<ol>
<li>This is item 1.
<li>This is item 2.
<li>This is a sublist:
<ol>
<li>subitem 1
<li>subitem 2
<li>subitem 3
</ol>
<li>This is item 3.
</ol>
 
</body>
</html>

Figure 1-10: Nested lists using ordered list tags

The code for Figure 1-10 is shown in Listing 1-6.

As you can see from Figure 1-10, using only Arabic numerals makes the view of the page confusing. However, both Netscape and Internet Explorer support the use of the TYPE and START tags. If you change the code marked in Listing 1-7, the result is easier to read.

Listing 1-7: The START and TYPE tags alter the look of ordered lists

<html>
<head>
<title>List Sample</title>
</head>
 
<body>
 
<ol type=I start=1>
<li>This is item 1.
<li>This is item 2.
<li>This is a sublist:
<ol>
<li>subitem 1
<li>subitem 2
<li>subitem 3
</ol>
<li>This is item 3.
</ol>
 
</body>
</html>

Figure 1-11: The lists are shown in a mix of Roman and Arabic numerals

The START parameter specifies the value with which to start the list. The TYPE parameter specifies the format in which the numbers should be displayed. Table 1-5 lists the valid parameter values.

Note: The value used for the TYPE parameter is case-sensitive.
 
Table 1-5: START Parameter Values
Value Result
A Capital letters (A, B, C, ...)
a Lowercase letters (a, b, c, ...)
I Large Roman numerals (I, II, III, ...)
ii Small Roman numerals (i, ii, iii, ...)
1 Arabic numerals (1, 2, 3, ...)

Table Formatting Tags

Tables are probably the most flexible of all the tags due to the unique way in which they can be combined. As you've probably seen by now, HTML evaluates from top to bottom and you don't have a lot of control over how the text is displayed. However, using tables can give you much greater control over how your text is displayed. While this section doesn't give you all of the ins and outs of using tables in unique ways, it teaches you enough to build the basic tables used throughout this book.

TABLE tag

The TABLE tag marks the beginning of a table. It can take a number of optional parameters, the most common of which are shown in Table 1-6.

The end of this section has a sample table using all the tags covered in the section. As with all table tags, be sure that you match the TABLE tag with a /TABLE tag, or the browser may not interpret the code properly.

Table 1-6: TABLE Tag Parameters
Parameter Name Description
ALIGN Specifies whether the table should be aligned to the left or right
BACKGROUND Specifies an image to use as the background of the table
BGCOLOR Specifies the color to be used as the background for the table
BORDER Specifies the width of the border around the table cells; if you use
CELLPADDING Specifies the number of pixels between the border of each cell and the contents of the cell
CELLSPACING Specifies the number of pixels between the cells in the table
COLS Specifies the number of columns in the table; this value is not
HEIGHT Specifies, in pixels or a percentage, the height of the table
WIDTH Specifies, in pixels or a percentage, the width of the table

TR tag

The TR tag marks the beginning of a table row. The tag can take several optional parameters, some of which are shown in Table 1-7.

Table 1-7: TR Tag Parameters
Parameter Name Description
ALIGN Specifies whether the contents of the cells in the row should be aligned to the left, center, or right side of the page
BACKGROUND Specifies an image to use as the background of the cells in the row
BGCOLOR Specifies the color to be used as the background for the cells in the row

The end of this section has a sample table using all of the tags covered in the section. As with all table tags, be sure that you match the TR tag with a /TR tag, or the browser may not interpret the code properly.

TH

The TH tag marks a table heading. A table heading can be used at the top of each column. The tag can take several optional parameters, some of which are shown in Table 1-8.....

Read More Show Less

Table of Contents

Preface.

Acknowledgments.

PART I: Language Tools.

Chapter 1: HTML Essentials.

Chapter 2: VBScript Language Elements.

Chapter 3: VBScript Functions and Objects.

PART II: ASP Concepts.

Chapter 4: Using Server-Side Includes.

Chapter 5: Using the Request Object.

Chapter 6: Using the Response Object.

Chapter 7: Using Cookies.

Chapter 8: Using the Application, Session, and Server Objects.

Chapter 9: Error Handling.

PART III: Integrating with Databases.

Chapter 10: Active Data Objects Essentials.

Chapter 11: Creating a Data Browser.

Chapter 12: Adding Data Entry Features.

Chapter 13: Enhancing the Data Browser.

Chapter 14: Advanced Database Integration.

PART IV: Integrating with Other Tools.

Chapter 15: Integrating with Index Server.

Chapter 16: Using Classes in Visual Basic.

Chapter 17: Using WebClasses.

Chapter 18: Integrating with Microsoft Transaction Server.

PART V: Building a Real-World Application.

Chapter 19: Creating a Discussion Forum.

Appendix A: Setting Up your Development Environment.

Appendix B: HTML Reference.

Appendix C: VBScript Reference.

Appendix D: Object Reference.

Appendix E: What's New in ASP 3.0.

Index.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Anonymous

    Posted December 4, 2002

    Does not work...

    I bought this book to learns ASP. I tried the first set of code and it doesn't work. I copied the code line-by-line and it does not do what the book says. I would not recommend this book for beginners. I guess I will have to brave the snow and exchange it for something else.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted June 12, 2000

    Very disappointed

    This books is so full of errors and bugs as to be useless. The section on Integrating with Databases (Chpts 10-14) is so buggy as to not work. To make matters worse, the Author keeps refering to the (nonexisting)CDROM. After downloading the promised code from the author's web page, I found that the code does not match what is in the book. This book is definitely not for beginners!

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)