Vous êtes sur la page 1sur 73

Appendices

Lab 1: Introduction to Active Server

Objectives
What You Will Learn
After completing this lab, you will be able to: Create basic script examples, demonstrating how to associate code with events or run inline. Create a script that combines client side and server side scripting.

Related Topics Covered in this Lab


Client Side Scripting

pport Training

Microsoft Confidential

November 2013

Appendices

Before You Begin


Prerequisites
This lab requires that icrosoft !nternet !nformation Server version ".# is installed on the local machine

sti!ated ti!e to co!plete this lab" #$ !inutes

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise & Co!paring Client 'ide and 'erver 'ide 'cripts


!n this exercise, you will create client side and server side script files, comparing the behavior of each. The purpose of this exercise is to demonstrate similarities and differences between server script and client script, not code structure. $xercises in subsequent lessons will focus on more closely on the code. %. To create the client side script example: &aunch '(T$)A*.$+$ and insert the following code example into a new document. <HTML> <BODY> This is a simple VBScript Demo. It calculates the number of <Script Lan"ua"e#$VBScript$> <%&& Sub 'in o()OnLoa Dim iTar"etYear* Tar"etDate* iDateDiff a!s until the en of the !ear.

iTar"etYear#Year+Date+,, Tar"etDate#DateSerial+iTar"etYear*-.*/-, iDateDiff#DateDiff+$ $*Date+,* Tar"etDate, Ms"bo0 $To a!1s ate is $ 2 Date+, a!s to !ear en .$ Ms"bo0 iDateDiff 2 $ more 3n &&> <4Script> <4Bo !> <4HTML> Save the file as C:,!'$T)-.,///0((T,C&!$'T*$ (.1T . &aunch icrosoft !nternet $xplorer and test the sample by browsing 1TT):22&ocal1ost2C&!$'T*$ (.1T . Allow the program to complete, dismissing the message box by clic3ing the button mar3ed 4(56. !n !$, view the 1T & source of the client program by selecting the Source menu item from the 7iew menu. /hat information is available in the Source8 !s the script code visible8 /ith what event is the script associated 9hint: loo3 at the name of the sub procedure:. Sub

pport Training

Microsoft Confidential

November 2013

Appendices

;.

To create the server side script example: &aunch '(T$)A*.$+$ and insert the following code example into a new document.

<HTML> <BODY> This is a ser5er 6S7 Demo. It calculates the number of <B8> <B8> <9 Dim iTar"etYear* Tar"etDate* iDateDiff a!s until the en of the !ear.

iTar"etYear#Year+Date+,, Tar"etDate#DateSerial+iTar"etYear*-.*/-, iDateDiff#DateDiff+$ $*Date+,* Tar"etDate, 8esponse.'rite $To a!1s ate is $ 2 Date+, 2 $.<B8>$ a!s to !ear en .$ 8esponse.'rite iDateDiff 2 $ more 9> <4BODY> <4HTML> Save the file as C:,!'$T)-.,///0((T,S$07$0*$ (.AS). &aunch icrosoft !nternet $xplorer and test the sample by browsing http:22localhost2S$07$0*$ (.AS). Allow the program to complete, dismissing the message box by clic3ing the button mar3ed 4(56. !n !$, view the 1T & source of the client program by selecting the Source menu item from the 7iew menu. /hat information is available in the Source8 !s the script code visible8 /ill the script run if the extension of the file is changed to 1T 8

pport Training

Microsoft Confidential

November 2013

Appendices

<.

To combine server side and client side scripting: &aunch '(T$)A*.$+$ and insert the following code example into a new document.

<HTML> <BODY> This is a simple client4ser5er Demo that calculates the number of until the en of the !ear. <B8> <B8> <9 Dim iTar"etYear* Tar"etDate* iDateDiff a!s

iTar"etYear#Year+Date+,, Tar"etDate#DateSerial+iTar"etYear*-.*/-, iDateDiff#DateDiff+$ $*Date+,* Tar"etDate, 9> <Script Lan"ua"e#$VBScript$> <%&& Sub 'in o()OnLoa Ms"Bo0 $To a!1s 3n &&> <4Script> <4BODY> <4HTML> Sub ate is <9#Date+,9>.$ a!s 1til !ear en .$ Ms"Bo0 $<9#iDateDiff9> more

pport Training

Microsoft Confidential

November 2013

Appendices

Save the file as C:,!'$T)-.,///0((T,1=.0!*.AS). &aunch icrosoft !nternet $xplorer and test the sample by browsing http:22localhost21=.0!*.AS). Allow the program to complete, dismissing the message box by clic3ing the button mar3ed 4(56. !n !$, view the 1T & source of the client program by selecting the Source menu item from the 7iew menu. /hat information is available in the Source8 !s the client side script visible8 !s the server side 9the formulas: visible8

Lab 2: Administrating IIS 4.0

Objectives
What You Will Learn
After completing this lab, you will be able to: Configure common application settings using the sheets. icrosoft anagement Console and !!S ".# property

Assign permissions to the !-S0>? account to allow proper access to AS).

Related Topics Covered in this Lab

Reco!!ended Reading

pport Training

Microsoft Confidential

November 2013

Appendices

Before You Begin


Prerequisites Lab 'etup
Copy all files from the student lab dis3 to a folder called &A.S, located in the root directory of your C: drive.

sti!ated ti!e to co!plete this lab" () !inutes

*or +ore ,nfor!ation


The /indows 'T ".# (ption )ac3 *ocumentation contains detailed information about setting up and administrating !!S ".#. !t includes topics on: /eb and @T) SitesA Configuring ApplicationsA SecurityA &oggingA )erformance Tuning. This information can be found in the contents under: /indows 'T ".# (ption )ac3 )roduct *ocumentation icrosoft !nternet !nformation Server 9!!S: Server Administration

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise & Configuring Applications


!n this exercise, you will create a new virtual directory that will be used throughout later exercises. =ou will examine settings available through !!S ".# )roperty sheets and configure the new virtual directory as an isolated application. ". To launch icrosoft !nternet Service anager B. @rom the Start (pen the enu, open the )rograms group. (pen the /indows 'T ".# (ption )ac3 group in the )rograms group. icrosoft !nternet !nformation Server in the /indows 'T ".# (ption )ac3. anager. Select !nternet Service

Clic3 on the button labeled 4Close6 to dismiss the Tip of the *ay dialog. To create a new virtual directory: !n CCs scope pane 9the left most window pane:, navigate to *efault /eb Site as shown below.

@rom the Action menu, select 'ew and choose 7irtual *irectory from the submenu. This should launch the 'ew 7irtual *irectory /iDard.

pport Training

Microsoft Confidential

November 2013

Appendices

Step through the wiDard using the 'ext button, providing the following information as shown in each of the following screen shots: $nter the alias used to access this virtual directory:

$nter the physical path containing the content:

pport Training

Microsoft Confidential

November 2013

Appendices

Erant the following access permissions to the virtual directory:

Clic3 the @inish button to complete the creation of the new 7irtual directory. !nternet Service anager should automatically mar3 the new 7irtual *irectory as an application. To test the new virtual directory, launch 1TT):22&ocal1ost2&abs2*efault.AS). icrosoft !nternet $xplorer and browse

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise .sing /arious Authentication +ethods


!n this exercise, you will create a new 'T user account that will provide restricted access to the web site and restrict anonymous access. Additionally, you will determine the 'T user account used by !!S ".# as the default anonymous user account. . To create a new user account under 'T: @rom /indow 'TCs Start menu, open the )rograms group. (pen the Administrative Tools 9Common: group in the )rograms group. Select -ser anager for *omains. @rom the -ser menu, select the 4'ew -serF6 menu item. @ill in the 'ew -ser dialog as shown below. .e sure to remove any chec3s in the chec3boxes for )assword options and Account disabled.

'ote: The password will actually show up as a series of asteris3s9?: for security purposes. Clic3 the button labeled 4Add6. Clic3 the button labeled 4Close6. @rom the -ser menu, select the $xit menu item.

pport Training

Microsoft Confidential

November 2013

Appendices

To secure the web site: &aunch !nternet Service anager. !n the scope pane, select the *efault /eb site for the local machine. @rom the Action menu, select )roperties. Switch to the *irectory Security tab in the *efault /eb Site )roperties dialog.

Clic3 the edit button located in the Anonymous Access and Authentication Control section. This will display the Authentication ethods dialog.

pport Training

Microsoft Confidential

November 2013

Appendices

Clear and set the options for the authentication methods as shown in the image below. $nsure that only .asic Authentication is enabled. 'ote: /hen enabling the .asic Authentication option you will receive a message from !nternet Service anager in a dialog. 0ead the warning, then dismiss this dialog box by clic3ing the button labeled G(5G.

Clic3 the button labeled 4(56 to dismiss the Authentication

ethods dialog.

Clic3 the button labeled 4(56 to dismiss the /eb Site property sheet. !f you receive an G!nheritance (verrideG dialog as3ing which child nodes should inherit the authentication method, clic3 the button labeled G(5G. Test the authentication method by browsing 1TT):22&ocal1ost from within $xplorer. 9!f necessary, launch !nternet $xplorer.: icrosoft !nternet

/hen prompted for authentication the first time, clic3 the button mar3ed 4Cancel6 to bypass the login to the web page. /hat is the browserCs response8 0efresh the web page using the toolbutton mar3ed 40efresh6. /hen prompted for authentication, type 4.asic-ser6 as the -ser 'ame and 4password6 as the )assword. *o not type the quotes for either -ser 'ame or )assword. Clic3 the button mar3ed 4(56 to accept the user name and password. !s access granted to the web site8

pport Training

Microsoft Confidential

November 2013

Appendices

To restore access to the web site: Switch to !nternet Service anager. !n the scope pane, select the *efault /eb site for the local machine. @rom the Action menu, select )roperties. Switch to the *irectory Security tab in the *efault /eb Site )roperties dialog. Clic3 the edit button located in the Anonymous Access and Authentication Control section. This will display the Authentication ethods dialog. $nable the 4Allow Anonymous Access6 option and disable the .asic Authentication option. /hen 4Allow Anonymous Access6 is enabled, clic3 the topmost button labeled 4$dit6, that lies next to the text 4Account used for Anonymous Access:6 /hat 'T -ser Account is !!S using for anonymous access8 Clic3 the button labeled 4(56 to dismiss the Anonymous -ser Account dialog. Clic3 the button labeled 4(56 to dismiss the Authentication ethods dialog. Clic3 the button labeled 4(56 to dismiss the *efault /eb Site )roperties dialog. !f you receive an G!nheritance (verrideG dialog as3ing which child nodes should inherit the authentication method, clic3 the button labeled G(5G. Switch to icrosoft !nternet $xplorer. .rowse the -0& http:22localhost 9!f itCs still the current page in the browser, simply clic3 on the toolbutton mar3ed 40efresh6.: Are you prompted for a user name and password8

Lab 3: Tools and Debugging

Objectives
What You Will Learn
After completing this lab, you will be able to: Create simple applications using icrosoft 7isual !nterdev. *ebug AS) scripts using the icrosoft Script *ebugger.

Reco!!ended Reading

pport Training

Microsoft Confidential

November 2013

Appendices

Before You Begin


Prerequisites
To complete the exercises in this lab, it is necessary to have *ebugger installed on your local machine. icrosoft 7isual !nterdev and icrosoft Script

sti!ated ti!e to co!plete this lab" #$ !inutes

*or +ore ,nfor!ation


7isual !nterdev (nline )roduct *ocumentation G-ser EuideGA (verview section

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise & Creating a 0uest Boo1 2ith /isual ,nterdev


!n this exercise, you will create a guest boo3 application using 7isual !nterdev. @or the guest boo3 to function properly, you will need to create a new proHect in 7isual !nterdev, provide access to a data source used to hold the guest information, and run the data form wiDard to create the forms, 1T & and AS) script that provides access to the guest boo3 information. . To create a new proHect: @rom the @ile menu, select 4'ewF6.

@ile 'ew dialog box: Switch to the )roHects tab and select 4/eb )roHect /iDard. Type the name /ebApp into the )roHect name text box. Clic3 the button labeled 4(56.

pport Training

Microsoft Confidential

November 2013

Appendices

Step % of ; dialog box: !n the Server 'ame text box, type 4&ocalhost6.

Clic3 the button labeled 4'ext6.

pport Training

Microsoft Confidential

November 2013

Appendices

Step ; of ; dialog box: Accept the defaults

Clic3 the button labeled 4@inish6.

pport Training

Microsoft Confidential

November 2013

Appendices

To add a data connection: @rom the )roHect menu, select 4Add to )roHect6, then select 4*ata Connection6.

SelectSwitch to the achine *ata Source tab. Select the data source 4Adv/or3s6 and clic3 on the button labeled 4(56.

pport Training

Microsoft Confidential

November 2013

Appendices

To create the data forms: @rom the @ile menu, select 4'ewF6.

@ile 'ew dialog box: Switch to the @ile /iDards tab. Type 4Euest.oo36 in the @ile name text box. Clic3 the button labeled 4(56.

pport Training

Microsoft Confidential

November 2013

Appendices

Step % of I dialog box: Select *ataConn from the dropdown as the database connection to use. Type 4Euest .oo3 Application6 in the text box provided for the title that appears at the top of the form.

Clic3 on the button labeled 4'ext6.

pport Training

Microsoft Confidential

November 2013

Appendices

Step ; of I dialog box: Choose Table from the listbox provided as the obHect to use for your form.

Clic3 on the button labeled 4'ext6.

pport Training

Microsoft Confidential

November 2013

Appendices

Step < of I dialog box: Choose Customers from the Table27iew dropdown. Clic3 the button labeled 4JJ6 to move all fields from the Available @ields listbox over to the Select @ields listbox.

Clic3 on the button labeled 4'ext6

pport Training

Microsoft Confidential

November 2013

Appendices

Step " of I dialog box: $xamine the options available within this dialog. Accept the defaults in the dialog.

/hat functionality does step " of the wiDard provide8 Clic3 on the button labeled 4'ext6.

pport Training

Microsoft Confidential

November 2013

Appendices

Step B of I dialog box: Accept the defaults in the dialog.

Clic3 on the button labeled 4'ext6.

pport Training

Microsoft Confidential

November 2013

Appendices

Step K of I dialog box: Accept the defaults in the dialog.

Clic3 on the button labeled 4'ext6.

pport Training

Microsoft Confidential

November 2013

Appendices

Step I of I dialog box: 1eave a sigh of relief, since there are no more dialogs.

Clic3 on the button labeled 4@inish6. 1ow many AS) files have been created8 Test the application by browsing the -0& 1TT):22&ocal1ost2/ebApp2Euest.oo3@orm.AS). Create a new record by clic3ing the button mar3ed G'ewG, filling in the fields, then clic3ing on the button mar3ed G!nsertG to add the record. $xperiment and see what the other buttons in the forms do.

,f Ti!e Per!its .sing /isual ,nterdev Wi3ards


*ata Connections provide access to external data sources. Through a data connection, you can add, delete or modify values in the underlying data. Additionally, you can create database diagrams displaying relationships between tables, view stored procedures, create new obHects and edit obHect properties. Ta3e some time to explore the *ata 7iew tab of the wor3space. This tab is available anytime a data connection exists in the current wor3space.

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise 4ebugging Active5 'erver Pages


!n this exercise, you will use the Script *ebugger to trouble script errors. !n order to use the script debugger with !!S ".#, it is necessary to enable server side script debugging within !nternet Service anager. (pen icrosoft !nternet $xplorer and browse the -0& 1TT):22&ocal1ost2&abs2&ab<2.ro3en.AS). !t should display an error message within the browser. . To enable server side debugging: &aunch !nternet Service anager. *isplay the property sheet for the &ab< folder found in the &abs application under the default web site. Create an application using &ab< as the application root. (nce &ab< is mar3ed as an application, the button mar3ed GConfigureG will be enabled in the property sheets dialog. Clic3 the Configure button to display the Application Configuration dialog. Switch to the App *ebugging tab of the Application Configuration dialog

$nable serverLside script debugging by placing a chec3 in the chec3box next to the label G$nable AS) serverLside script debuggingG. Clic3 on the button labeled G(5G to dismiss the Application Configuration dialog. Clic3 on the button labeled G(5G to dismiss the )roperty Sheets dialog.

pport Training

Microsoft Confidential

November 2013

Appendices

To debug errors: Switch bac3 to icrosoft !nternet $xplorer and browse the page 1TT):22&ocal1ost2&abs2&ab<2.ro3en.AS). /hat happens this time8 /hich line is the cursor on in the script debugger8 Switch bac3 to icrosoft !nternet $xplorer. 'ote that the browser should be displaying the cursor as an hourglass. Switch bac3 to icrosoft Script *ebugger. @rom the *ebug menu, select GStop *ebuggingG. 1as the cursor changed in icrosoft !nternet $xplorer8 Close the copy of .ro3en.AS) that is open in open. icrosoft Script *ebugger, leaving Script *ebugger

&aunch '(T$)A*.$+$ and open the file C:,&abs,&ab<,.ro3en.AS). Correct the spelling of the variable i1our in line nine. Save the changes to the file. Switch bac3 to icrosoft !nternet $xplorer and update the script page by clic3ing on the toolbutton labeled G0efreshG. *oes the script wor38 *oes it display a message appropriate for the time of day shown by the computerMs system cloc38 Switch bac3 to icrosoft Script *ebugger. icrosoft Active Server )ages until you locate bro3en.asp @rom the 7iew menu, select G0unning *ocumentsG. $xpand the section listed as

*ouble clic3 on bro3en.asp in the 0unning *ocuments window. This should open a readLonly copy of the newest version of bro3en.asp.

pport Training

Microsoft Confidential

November 2013

Appendices

&ocate the line that reads: i1ourN1our9Time9:: )lace the cursor at the beginning of this line. @rom the *ebug enu, select GToggle .rea3pointG. This should cause the line to change appearance as shown below, which indicates there is a brea3point on the line.

Switch to icrosoft !nternet $xplorer and browse the page 1TT):22&ocal1ost2&abs2&ab<2.ro3en.AS). At this point, icrosoft Script *ebugger should appear, with execution of .ro3en.AS) paused at the brea3point and a yellow arrow appears on the left side of our readLonly file. At which line does the yellow arrow point8 @rom the *ebug menu, select GStep !ntoG. *id the yellow arrow move to a different line8 0epeat the previous step repeatedly until the yellow arrow points to the line containing the $nd !f statement. /hich path did the script run, GEood orningG or GEood AfternoonG8 !s this correct for the current time of day8

pport Training

Microsoft Confidential

November 2013

Appendices

Chec3 the value of i1our: @rom the 7iew menu, select GCommand /indowG. !nside the Command /indow, type 8 i1our )ress $nter.

/hat is the value of i1our on your machine8

!t appears that .ro3en.AS) is printing the wrong message for the current time of day. Can you fix .ro3en.AS) to correct this8

Lab 4: Built in !b"ects

Objectives
What You Will Learn
After completing this lab, you will be able to: Access information supplied by the user through forms. -se coo3ies to trac3 user information. -se the E&(.A&.ASA file to run special subroutines upon starting and quitting sessions. -se the 0esponse obHect to send information bac3 to the userCs browser. Add transaction processing using the OPQT0A'SACT!('N60$R-!0$*6PJ directive.

pport Training

Microsoft Confidential

November 2013

Appendices

Related Topics Covered in this Lab

Reco!!ended Reading
/indows 'T ".# (ption )ac3 *ocumentation.

pport Training

Microsoft Confidential

November 2013

Appendices

Before You Begin


Prerequisites
The exercises for this lab require that the C:,&abs folder and &abs virtual directory have been created according to the directions in &ab #; S Administration and Configuration.

sti!ated ti!e to co!plete this lab" 6$ !inutes

*or +ore ,nfor!ation


The /indows 'T ".# (ption )ac3 *ocumentation contains several code examples and greater detail of the builtLin components included with !!S ".#. =ou can locate this information by tracing the following path from the content pane of the /indows 'T ".# (ption )ac3 )roduct *ocumentation. /indows 'T ".# (ption )ac3 )roduct *ocumentation icrosoft !nternet !nformation Server 9!!S: ScripterCs 0eference .uiltLin AS) (bHects

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise & .sing the Response and Request objects


!n this exercise, you will use the 0equest obHect in order to retrieve 1TT) server variables for the current session. Server variables contain information about both the server and the browser, which can be used to perform scripts when a server variable matches a value determined by the web developer. !n the first exercise, you will create a table that lists the server variables available with their associated values, and add an image tag to the end of the file that determines which of two languages your browser supports. !n the second half of the exercise, you will create an AS) page that will automatically redirect the browser to a new web page dependent upon which language their browser is setup. . To display the server variables in a web page: &aunch '(T$)A*.$+$ or a new file: icrosoft 7isual !nterdev and insert the script on the following page into

pport Training

Microsoft Confidential

November 2013

Appendices

<HTML> <BODY> <Table bor er#.> <T8><TH>:ame<4TH><TH>Value<4TH> <91Loop throu"h all 5alues an print in table ;or each ob<s5ar in 8e=uest.Ser5erVariables 8esponse.'rite $<T8><TD>$ 8esponse.'rite ob<s5ar 8esponse.'rite $<4TD><TD>$ 8esponse.'rite 8e=uest.Ser5erVariables+ob<s5ar, 8esponse.'rite $<4TD><4T8>$ :e0t9> <4T6BL3> <91>hec? for 3n"lish @S or AB to see (hich fla" to sho( Lan"ua"e#8e=uest.Ser5erVariables+$HTT7)6>>37T)L6:A@6A3$, If Lan"ua"e#$en&us$ then s;la"AI;#$@S6.AI;$ 3lseIf Lan"ua"e#$en&"b$ Then s;la"Aif#$@B.AI;$ 3lse s;la"AI;#$$ 3n If9> 'elcome%<B8> <IMA S8>#$..4Ima"es4<9#s;la"Aif9>$> <4BODY> <4HTML> /hat are the two methods this code uses to send information bac3 to the browser8 Save the file as C:,&abs,&ab",Server7ariables.AS). Test the script by browsing 1TT):22&ocal1ost2&abs2&ab"2Server7ariables.AS). /hich flag is displayed at the bottom of the page8

pport Training

Microsoft Confidential

November 2013

Appendices

!n icrosoft !nternet $xplorer, change the browserCs default language from -S $nglish to .ritish $nglish: . To change $xplorerCs default language: Select 4!nternet (ptions6 from the 7iew menu in !nternet $xplorer. Clic3 on the button labeled 4&anguages6 found on the Eeneral tab.

0emove any languages listed in the language listbox by highlighting the language and clic3ing the button labeled 40emove6. Clic3 the button labeled 4Add6. Select the line that reads 4$nglish 9.ritish: TenLgbU and clic3 on the button labeled 4(56. Clic3 the button labeled 4(56 to dismiss the language dialog box. Clic3 the button labeled 4(56 to dismiss the !nternet (ptions dialog box. 0efresh the current page by clic3ing on the toolbutton labeled 40efresh6. /hat flag is now displayed at the bottom of the page8

pport Training

Microsoft Confidential

November 2013

Appendices

To redirect users to a specific page dependent upon a server variable: &aunch '(T$)A*.$+$ or icrosoft 7isual !nterdev and insert the following script into a new file:

<98esponse.Buffer#True9> <HTML> <BODY> >hec?in" lan"ua"e... <9 Lan"ua"e#8e=uest.Ser5erVariables+$HTT7)6>>37T)L6:A@6A3$, If Lan"ua"e#$en&us$ Then :e(Site#$@S3n"lish.HTM$ 3lseIf Lan"ua"e#$en&"b$ Then :e(Site#$@B3n"lish.HTM$ 3lse :e(Site#$@nBno(n.HTM$ 3n If

8esponse.8e irect :e(Site 9> <4BODY> <4HTML> Save the file as C:,&abs,&ab",&anguageStart.AS). Test the script by browsing 1TT):22&ocal1ost2&abs2&ab"2&anguageStart.AS). /hat is the -0& displayed in the address bar of icrosoft !nternet $xplorer8 0estore $xplorerCs default language to $nglish 9-nited States:TenLusU. .rowse 1TT):22&ocal1ost2&abs2&ab"2&anguageStart.AS). *o you wind up on the same page as you did the previous time8

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise Retrieving values fro! for!s using the Post +ethod


!n this exercise, you will use the post method to retrieve data from information supplied by a user by way of a form. %#"K#. To create a user form: (pen -sing)ost.htm in either 'otepad.exe or 7isual !nterdev. This file is found in the C:,&abs,&abs" folder. odify the O@(0 J tag to match the O@(0 J tag listed below: /hat does the action argument identify8 Can you identify the text boxes and their names8 Save the changes for this file. Create a new text file using either '(T$)A*.$+$ or AS) file using 7isual !nterdev. !nsert the script listed below into the new text file.

<;O8M metho #$7ost$ action#$7rocess7ost.asp$>

%#"K%. To retrieve user data:

<HTML> <BODY> <9 s8esponse-#8e=uest+$te0t-$, 2 $<B8>$ s8esponse.#Ser5er.HTML3nco e+8e=uest+$te0t.$,, 2 $<B8>$ 8esponse.'rite $te0t-#$ 2 s8esponse8esponse.'rite $te0t.#$ 2 s8esponse. 9> <4BODY> <4HTML> Save the new file as )rocess)ost.asp in the C:,&abs,&ab" folder. Test the application by browsing the following -0& in 1TT):22&ocal1ost2&abs2&ab"2-sing)ost.1T . icrosoft !nternet $xplorer:

!n both Text% and Text; text boxes, type 4O.J1$&&(O2.J6 9without the quotes:. Clic3 the button labeled 4(56. *id the new page display the contents of the two text boxes8 1ow do the two values differ8 1ow does the script in )rocess)ost.asp handle the two inputs differently that accounts for the difference8

,f Ti!e Per!its Retrieving /alues fro! *or!s


The examples from this exercise used two separate files to enter and display the information from the form. Create an example that ma3es use of one form only 9the action argument of the O@(0 J tag calls itself:.

pport Training

Microsoft Confidential

November 2013

Appendices

So if the name of the script file is Test.asp, then the form tag will be O@(0 $T1(*N6)(ST6J.

ACT!('N6T$ST.AS)6

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise # Retrieving values fro! for!s using the 0et +ethod


!n this exercise, you will use the get method to retrieve data from information supplied by a user by way of a form. %"BB;. To create a user form: (pen -singEet.htm in either 'otepad.exe or 7isual !nterdev. This file is found in the C:,&abs,&abs" folder. odify the O@(0 J tag to match the O@(0 J tag listed below: /hat does the action argument identify8 Can you identify the text boxes and their names8 Save the changes for this file. Create a new text file using either '(T$)A*.$+$ or AS) file using 7isual !nterdev. !nsert the script listed below into the new text file.

<;O8M metho #$Aet$ action#$7rocessAet.asp$>

%"BB<. To retrieve user data:

<HTML> <BODY> <9 s8esponse-#8e=uest.Cuer!strin"+$te0t-$, s8esponse.#Ser5er.HTML3nco e+8e=uest.Cuer!Strin"+$te0t.D,, 8esponse.'rite $te0t-#$ 2 s8esponse- 2 $<B8>$ 8esponse.'rite $te0t.#$ 2 s8esponse. 2 $<B8>$ 9> <4BODY> <4HTML> Save the new file as )rocessEet.asp in the C:,&abs,&ab" folder. Test the application by browsing the following -0& in 1TT):22&ocal1ost2&abs2&ab"2-singEet.1T . icrosoft !nternet $xplorer:

!n both Text% and Text; text boxes, type 4O.J1$&&(O2.J6 9without the quotes:. Clic3 the button labeled 4(56. *id the new page display the contents of the two text boxes8 /hat appears with the -0& in the address bar of icrosoft !nternet $xplorer8

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise ( Passing infor!ation bet2een pages and users


!n this exercise, you will use the Session obHect and the Application obHect to pass information to multiple web pages or between users using the same application. &aunch '(T$)A*.$+$ or 7isual !nterdev and create a new text file. !nsert the following script into the new document:

<HTML> <BODY> <9 6pplication+$:ame$,#8e=uest.Ser5erVariables+$83MOT3)6DD8$, Session+$:ame$,#8e=uest.Ser5erVariables+$83MOT3)6DD8$, 9> 7a"e One<B8> 6pplication#<9#6pplication+$:ame$,9><B8> Session#<9#Session+$:ame$,9><B8> <6 H83;#$7a"eT(o.6S7$>Ao To :e0t 7a"e<46> <4BODY> <4HTML> Save the file as C:,&abs,&ab",)age(ne.AS). Create another new text file and insert the following script:

<HTML> <BODY> 7a"e T(o<B8> 6pplication#<9#6pplication+$:ame$,9><B8> Session#<9#Session+$:ame$,9><B8> <9Session.6ban on 8esponse.'rite $Session ob<ect close Session#<9#Session+$:ame$,9><B8> <6 H83;#$7a"eThree.6S7$>Ao To :e0t 7a"e<46> <4BODY> <4HTML> Save the file as C:,&abs,&ab",)ageTwo.AS). +Session.6ban on,$9>

pport Training

Microsoft Confidential

November 2013

Appendices

Create a third text file and insert the following script:

<HTML> <BODY> 7a"e Three<B8> 6pplication#<9#6pplication+$:ame$,9><B8> Session#<9#Session+$:ame$,9><B8> <4BODY> <4HTML> Save the file as C:,&abs,&ab",)ageThree.AS). &aunch icrosoft !nternet $xplorer and test the application by browsing 1TT):22&ocal1ost2&abs2&ab"2)age(ne.AS). /hat are the values of Application and Session8 @ollow the lin3 to the next page. *id Application and Session retain their values8 /hat is the purpose of the Session.Abandon method8 @ollow the lin3 to the next page. *id Application and Session retain their values8 /hat caused Session to lose its value8 1ave your neighbor browse your )age(ne script 91TT):22machinename2&abs2&ab"2)age(ne.AS) where machinename is the computer name of your machine:. a3e note of the values in )ageThree.AS) on your machine. 0efresh the page in your browser using the toolbutton mar3ed 40efresh6. /hat happened to the values when you refreshed your page8 /hy did the Application value change8

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise ) 'toring and retrieving values 2ith coo1ies


!n this exercise, you will use coo3ies as a semiLpermanent storage medium. Coo3ie values are stored on the browser using 0esponse.Coo3ie, and are retrieved using 0equest.Coo3ie. Coo3ies are often used to store user preferences across sessions or act as shopping carts for web stores. &aunch '(T$)A*.$+$ or 7isual !nterdev. !n a new document, insert the following script: <918esponse.>oo?ies re=uire bufferin" 8esponse.Buffer#True9> <HTML> <BODY> <9 Dim LastVisite

E8etrie5e pre5ious 5alue of >oo?ie LastVisite #8e=uest.>oo?ies+$LastVisit$, E>hec? if If 3lse 8esponse.'rite $'elcome Bac?%<B8>$ 8esponse.'rite 3n If $You last 5isite on $ 2 LastVisite LastVisite #3mpt! then 8esponse.'rite $'elcome. This is !our first 5isit$

8esponse.>oo?ies+$LastVisit$,#:o(+, 8esponse.>oo?ies+$LastVisit$,.30pires#$December /-* .FFF$ 1The ne0t line forces the session to =uit 1pro5in" that no session 5ariable is in5ol5e Session.6ban on 9> <4BODY> <4HTML>

pport Training

Microsoft Confidential

November 2013

Appendices

Save the file as C:,!'$T)-.,///0((T,C((5!$S.AS). &aunch icrosoft !nternet $xplorer and test the script by browsing 1TT):22&ocal1ost2C((5!$S.AS). /hat is displayed in the browser8 Shut down !nternet $xplorer, then repeat the previous step. *id you receive a new message in the browser8

,f Ti!e Per!its 'toring and retrieving values 2ith coo1ies


7isual !nterdev contains a sample application that incorporates a shopping application. -se 7isual !nterdev to create the sample application proHect called *os )erros and examine the shopping application.

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise 7 .sing the 0LOBAL8A'A file


!n this exercise, you will create a E&(.A&.ASA file to trac3 web usage. The E&(.A&.ASA file provides a mechanism to run special procedures when application and sessions either start or terminate. This provides the ability to run code for each new session on the web server. This is an instructor led exercise, where the final script is generated by the class as a group.

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise 9 .sing Transactions


!n this exercise, you will add transaction processing to a web page. Transactions are typically used while manipulating data within databases. !f a web page that processes data abnormally ends, the database could be left in an incomplete state. Transactions provide the mechanism to recover from these incomplete states. /hile this example does not demonstrate transactions using databases, the next module covering databases will provide a lab demonstrating the use of transactions with databases. <9 Sub OnTransaction6bort+, 8esponse.'rite $<B8><B>3rror 3n Sub etecte . :o( reco5erin"$ 17lace error han lin" co e here .rowse the page 1TT):22&ocal1ost2&abs2&ab"2Transaction.asp. !t should return an error message. (pen Transaction.asp in either 'otepad or 7isual !nterdev. Add the following 7.Script to the end of the file:

Sub OnTransaction>ommit+, 8esponse.'rite $<B8><B>Transaction committe <4B>$ 3n 9> Save the changes to Transaction.asp. .rowse the page 1TT):22&ocal1ost2&abs2&ab"2Transaction.asp. !s the output any different8 (pen Transaction.asp in either 'otepad or 7isual !nterdev. Add the following 7.Script as the first line. Lan"ua"e#DVBScriptD9> Save the changes to Transaction.asp. Sub

<9GTransaction#8e=uire

.rowse the page 1TT):22&ocal1ost2&abs2&ab"2Transaction.asp. !s the output any different8

pport Training

Microsoft Confidential

November 2013

Appendices

Lab #: Installable $om%onents

Objectives
What You Will Learn
After completing this lab, you will be able to: Send email from a web page using Collaboration *ata (bHects. Create a script that accesses external data using A*(. aintain consistent data by using stored procedures and transactions within A*(. -se the .rowser Capabilities component to identify clientLside 9browser: specifics.

Related Topics Covered in this Lab

Reco!!ended Reading
/indows 'T ".# (ption )ac3 *ocumentation.

pport Training

Microsoft Confidential

November 2013

Appendices

Before You Begin


Prerequisites
This lab assumes you have performed a full install of !!S ".# to your local machine and the *S' Adv/or3s configured properly.

Lab 'etup
This lab assumes you have copied the labs folder as instructed by the instructor and created a virtual directory called &A.S under !!S ".#.

sti!ated ti!e to co!plete this lab" 9) !inutes

*or +ore ,nfor!ation


The /indows 'T ".# (ption )ac3 *ocumentation contains several code examples and greater detail of the installable components included with !!S ".#. =ou can locate this information by tracing the following path from the content pane of the /indows 'T ".# (ption )ac3 )roduct *ocumentation. /indows 'T ".# (ption )ac3 )roduct *ocumentation icrosoft !nternet !nformation Server 9!!S: ScripterCs 0eference !nstallable Components for AS).

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise & 4eter!ining bro2ser capabilities


!n this exercise, you will use the .rowser Capabilities obHect to determine what features a browser supports. &aunch icrosoft !nternet $xplorer and browse the -0& 1TT):22&ocal1ost2&abs2&abB2.rowser.AS) /hat technologies are listed8 /hat setting is shown for Active+Controls8 -sing '(T$)A*.$+$, open the file C:,/!''T,S=ST$ <;,!'$TS07,.0(/SCA).!'!. &ocate the section labeled T!$ ".#U in the .0(/SCA).!'! file. @ind the line that reads Active+ControlsNT0-$ in the T!$ ".#U section and change it to read Active+ControlsN@A&S$ Save the changes to the file and close 'otepad. Switch bac3 to icrosoft !nternet $xplore and refresh the .rowser.AS) page. /hat setting is displayed for Active+Controls now8 (pen '(T$)A*.$+$ and insert the following script into a new file:

<98esponse.Buffer#True9> <HTML> <BODY> <9 Set B8'#>reateOb<ect+$MS'>.Bro(serT!pe$, If B8'.Tables#True Then 8esponse.8e irect $'ithTables.HTM$ 3lse 8esponse.8e irect $'ithoutTables.HTM$ 3n 9> <4BODY> <4HTML> Save the file as C:,&abs,&abB,*efault.AS). &oo3 at the script and try to determine which page will appear if you browse 1TT):22&ocal1ost2&abs2&abB2*efault.AS), based on the information you saw in .0(/S$0.AS). 9*o not browse the page until you have made a guess.: Switch bac3 to icrosoft !nternet $xplorer and browse 1TT):22&ocal1ost2&abs2&abB2*efault.AS). /as the browser redirected to the page you predicted8 /hat change to the .0(/SCA).!'! file can you ma3e to change this behavior8 If

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise Accessing 4ata using A'P scripts


!n this exercise, you will retrieve data from an Access database and display the records from a table within the database on a web page, using Active+ *ata (bHects. /eb developers often use A*( to create guest boo3s, bulletin board systems or even order trac3ing tools. To successfully create this web page, you must create a system data source within (*.C manager 9youMll use one already installed by !!S ".#:, instruct AS) to include special constants required for A*( and finally retrieve the data using a recordset obHect. %. To create the system data source: ;. <. @rom the Start enu, select Settings and launch Control )anel. *oubleLclic3 on the (*.C icon in Control )anel. Switch to the System *S' tab. 7erify that Adv/or3s is listed as a *ata Source in the System *ata Sources list box. To create the web page: -se '(T$)A*.$+$ to open the file C:,&abs,&abB,S! )&$A*(.AS). To include the special constants required by A*(: Type the following line into S! )&$A*(.AS), immediately below the comment OVLL )lace include here LLJ. To create an A*( recordset obHect and access records from the database: Type the following script into S! )&$A*(.AS) immediately below the comment GM)lace Code 1ereG

<%&&Hinclu e file # $a o5bs.inc$&&> ".

Dim ob<8S Set ob<8S#Ser5er.>reateob<ect+$6DODB.8ecor set$, ob<8S.Open $Select I from 3mplo!ees$*$DS:#6DV'or?sJ$ Do @ntil ob<8S.3O; 8esponse.'rite ob<8S.;iel s+-, 2 $2H/.$ 8esponse.'rite ob<8S.;iel s+$Last:ame$, 2 $<B8>$ ob<8S.Mo5e:e0t Loop ob<8S.>lose Set ob<8S#:othin" Save the changes to S! )&$A*(.AS). Test S! )&$A*(.AS) by launching 1TT):22&ocal1ost2&abs2S! )&$A*(.AS) in !nternet $xplorer.

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise # Adding :e2 4ata using A4O


!n this exercise, you will create new records from data provided in a form by the user. !n this example, you will continue using the data source Adv/or3s and the employees table from that database. To view whether the code successfully added the new record from the form, this sample will call the AS) page from the previous example to display all records from the employees table. %. To setup the form to capture the userMs data: ;. -sing 'otepad, open the file CA)-S$0.1T , which is found in the &A.S folder. odify the line containing the O@(0 J tag as follows: Save the changes to CA)-S$0.1T . To insert a new record: -se '(T$)A*.$+$ to open the file A**-S$0.AS), found in the &A.S folder. !n A**-S$0.AS), immediately following the comment MA** SC0!)T 1$0$M, add the script that follows on the next page.

<;O8M Metho #$7ost$ 6ction#$6DD@S38.6S7$>

pport Training

Microsoft Confidential

November 2013

Appendices

On 3rror 8esume :e0t Set ob<>onn # >reateOb<ect+$a o b.connection$, Set ob<>m # >reateOb<ect+$a o b.comman $,

ob<>onn.Open $DS:#6 5'or?s$ Set ob<>m .6cti5e>onnection # ob<>onn 1Buil SCL strin" to e0ecute

s;irst#$1$ 2 8e=uest+$;:ame$, 2 $1$ sLast#$1$ 2 8e=uest+$L:ame$, 2 $1$ sSelect#$Select $ 2 s;irst 2 $*$ 2 sLast 2 $J$ sIns#$Insert into 3mplo!ees+;irst:ame*Last:ame, $ ob<>m .>omman Te0t # sIns 2 sSelect ob<>m .30ecute 1>hec? for success If ob<>onn.3rrors.>ount#F Then 8esponse.'rite $Successfull! a 3lse 8esponse.'rite $>oul 3n If not a ne( recor $ e recor $

ob<>onn.>lose Set ob<>onn#:othin" Save the changes to A**-S$0.AS) and test by browsing 1TT):22&(CA&1(ST2&abs2&abB2CA)-S$0.1T in icrosoft !nternet $xplorer. Add yourself as a new user and clic3 the A** button. !f you receive a notice the record was added successfully, clic3 the 7!$/ A&& button on the result page to verify that your name has been added to the $mployees table.

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise ( .sing 'tored Procedures and Para!eters


!n this exercise, you will access stored procedures on a SR& Server to perform common tas3s within the database. This exercise is a instructor led assignment which is created together by the class. The finished code can be viewed in 1TT):22&ocal1ost2&abs2&abB2Stored)roc.AS).

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise ) .sing Transactions 2ith A4O


!n this exercise, you will create new records from data provided in a form by the user. !n this example, you will continue using the data source Adv/or3s and the employees table from that database. To view whether the code successfully added the new record from the form, this sample will call the AS) page from the previous example to display all records from the employees table. This exercise is a instructor led assignment which is created together by the class. The finished code can be viewed in 1TT):22&ocal1ost2&abs2&abB2A*(Transact.AS).

pport Training

Microsoft Confidential

November 2013

Appendices

%ercise 7 'ending +ail using an A'P script


!n this exercise, you will create a web page that sends S T) mail using information provided from a form. This is a common request of web developers. %. To capture user information in a form: ;. &aunch your favorite 1T & editor and open $ A!&@0 .1T , found in the C:,&abs,&abB folder. &ocate the O@(0 J tag and modify the tag to read as follows. O@(0 $T1(*NG)ostG ACT!('NGS$'* A!&.AS)GJ Save the changes to $ A!&@0 .1T To create a mail obHect -sing 'otepad or your favorite editor, open S$'* A!&.AS), also found in the C:,&abs,&abB folder. Add the following 7.Script to S$'* A!&.AS). The 7.Script should be placed immediately following the comment GMA** A!& C(*$ 1$0$G. Dim ob<:e(Mail Set ob<:e(Mail#Ser5er.>reateOb<ect+$>DO:TS.:e(Mail$, Ob<:e(Mail.Sen <. s;rom:ame*sTo:ame*sSub<ect*sMs" Set ob<:e(Mail#:othin" Save the changes made to S$'* A!&.AS) To test the application: &aunch !nternet $xplorer and browse 1TT):22&(CA&1(ST2&A.S2&A.B2$ A!&@0 .1T . @ill out the information requested in the form, using valid email names for 4@rom6 and 4To6. Clic3 on the GSendG .utton.

,f Ti!e Per!its 'ending +ail using an A'P script


S$'* A!&.AS) is very simplistic, in that it does not perform any error trapping. odify S$'* A!&.AS) to chec3 whether the user has filled in all fields from $ A!&@0 .1T , whether the 'ew ail obHect is created successfully 9use !s(bHect9::, and the Send command succeeded 9chec3 $00.'- .$0:. To incorporate error trapping, you will need to use the statement G(n $rror 0esume 'extG at the prior to creating the 'ew ail obHect.

A%%endi& A 'ersion (istor) o* 'BScri%t

The following table lists the version of applications. 1ost icrosoft !nternet $xplorer <.#

icrosoft 7isual .asic Scripting $dition implemented by host 7.Script 7ersion %.# 7.Script 7ersion ;.# 7.Script 7ersion <.#

pport Training

Microsoft Confidential

November 2013

Appendices

icrosoft !nternet !nformation Server <.# icrosoft !nternet $xplorer ".# icrosoft !nternet !nformation Server ".# icrosoft /indows Scripting 1ost %.# icrosoft (utloo3 WX

The following pages contains a listing of features specific to each version of 7.Script, sorted by type and feature name alphabetically. @or a complete listing of 7.Script 3eywords, or detailed information on a specific 3eyword, please refer to the /indows 'T ".# (ption )ac3 )roduct documentation in the following section: /indows 'T ".# (ption )ac3 )roduct *ocumentation icrosoft !nternet !nformation Server 9!!S: ScripterCs 0eference 7.Script &anguage 0eference

pport Training

Microsoft Confidential

November 2013

Appendices

t 1.0 +eatures

+unctions

Abs Asc Atn CBool CByte CCur CDate CDbl Chr CInt Cos CSng CStr Date DateSerial DateValue Day Exp Fix Hex Hour InputBox InStr Int IsArray IsDate
Microsoft Confidential November 2013

IsEmpty IsNull IsNumeric IsObject Boun!

pport Training

Appendices

Case e"t en og #rim $i! $inute $onth $sgBox No%

Oct &ight &n! &#rim Secon! Sgn Sin Space S'r StrComp

#an #ime #imeSerial #imeValue #rim (Boun! (Case Var#ype )ee*!ay +ear

,et-ods

Clear

&aise

pport Training

Microsoft Confidential

November 2013

Appendices

!b"ects

Error

.ro%erties

Description Number

Source

pport Training

Microsoft Confidential

November 2013

Appendices

Statements

Call Dim Do,,, oop Empty Erase Exit False For,,,Next Function I",,,#hen,,,Else Nothing

Null On-Error Option-Explicit &an!omi.e &eDim &em Select-Case Set Sub #rue )hile,,,)en!

pport Training

Microsoft Confidential

November 2013

Appendices

'BScri%t 2.0 +eatures

$onstants

Color Comparison Date-an!-#ime Date-Format File-Input/Output

$iscellaneous $sgBox String Var#ype-

pport Training

Microsoft Confidential

November 2013

Appendices

+unctions

Array CreateObject DateA!! DateDi"" Date0art Filter FormatCurrency FormatDate#ime FormatNumber Format0ercent 1etObject Instr&e2 3oin

oa!0icture $onthName &eplace &1B &oun! ScriptEngine ScriptEngineBuil!Version ScriptEngine$ajorVersion ScriptEngine$inorVersion Split Str&e2erse #ypeName )ee*!ayName-

pport Training

Microsoft Confidential

November 2013

Appendices

,et-ods

A!! Close Create#extFile Exists Items 4eys Open#extFile &ea! &ea!All

&ea! ine &emo2e &emo2eAll S*ip S*ip ine )rite )riteBlan* ines )rite ine-

!b"ects

Dictionary FileSystemObject

#extStream

pport Training

Microsoft Confidential

November 2013

Appendices

.ro%erties

AtEn!O" ine AtEn!O"Stream Column Compare$o!e Count

HelpContext HelpFile Item 4ey ine-

Statements

Const For-Each,,,Next

0ri2ate 0ublic-

pport Training

Microsoft Confidential

November 2013

Appendices

'BScri%t 3.0 +eatures

$ollections

*rives @iles

@olders

$onstants
Microsoft Confidential November 2013

pport Training

Appendices

*riveType @ile Attribute

Special@older

,et-ods

pport Training

Microsoft Confidential

November 2013

Appendices

Add@olders .uild)ath Copy Copy@ile Copy@older Create@older *elete *elete@ile *elete@older *rive$xists @ile$xists @older$xists EetAbsolute)ath'ame Eet.ase'ame

pport Training

Microsoft Confidential

November 2013

Appendices

Eet*rive Eet*rive'ame Eet$xtension'ame Eet@ile Eet@ile'ame Eet@older Eet)arent@older'ame EetSpecial@older EetTemp'ame ove ove@ile ove@older (penAsTextStream

!b"ects

*rive @ile

@older

.ro%erties
Microsoft Confidential November 2013

pport Training

Properties

76

upport Training

+icrosoft Confidential

:ove!ber -$&#

Properties

9$

Attributes AvailableSpace *ateCreated *ate&astAccessed *ate&ast odified *rive *rive&etter *rives *riveType @iles @ileSystem @reeSpace !s0eady !s0oot@older

upport Training

+icrosoft Confidential

:ove!ber -$&#

Properties

9&

'ame )arent@older )ath 0oot@older Serial'umber Share'ame Short'ame Short)ath SiDe Sub@olders TotalSiDe Type 7olume'ame
Microsoft Visual Basic Scripting Edition

Visual Basic for Applications Features not in VBScript


Category Array Handling "ollection Omitted Feature/Keyword Option Base Declaring arrays with lower bound < ! Add# "ount# $te%# &e%o'e Access to collections using ( character )e*g*# My"ollection(+oo, -"onst -$f***.hen***-Else DoE'ents /oSub***&eturn# /o.o On Error /o.o On***/oSub# On***/o.o 0ine nu%bers# 0ine labels 1ith***End 1ith "Var# "VDate Str# Val All intrinsic data types e2cept Variant .ype***End .ype Date state%ent# .i%e state%ent .i%er 0in4E2ecute# 0in45o4e# 0in4&e6uest# 0in4Send Debug*5rint End# Stop Declare )for declaring D00s, 7ew Optional 5ara%Array 5roperty /et# 5roperty 0et# 5roperty Set Static Erl Error

"onditional "o%pilation "ontrol +low

"on'ersion Data .ypes Date3.i%e DDE Debugging Declaration

Error Handling

upport Training

+icrosoft Confidential

:ove!ber -$&#

Properties

9-

Microsoft Visual Basic Scripting Edition

Visual Basic for Applications Features not in VBScript


On Error***&esu%e &esu%e# &esu%e 7e2t +ile $nput3Output All traditional Basic file $3O +inancial All financial functions Ob8ect Manipulation .ypeOf Ob8ects "lipboard "ollection Operators 0i4e Options Deftype Option Base Option "o%pare Option 5ri'ate Module Category Omitted Feature/Keyword Select "ase E2pressions containing Is 4eyword or any co%parison operators E2pressions containing a range of 'alues using the To 4eyword* Strings +i2ed9length strings 0Set# &Set Mid State%ent Str"on' :sing Ob8ects "ollection access using ( ; <==> Microsoft "orporation* All rights reser'ed*
Microsoft Visual Basic Scripting Edition

VBScript Features not in Visual Basic for Applications


"ontents Category +or%atting strings

0anguage &eference

$ntrinsic constants

Feature/Keyword +or%at"urrency +or%atDate.i%e +or%at7u%ber +or%at5ercent Month7a%e 1ee4day7a%e 'b/eneralDate 'b0ongDate 'b0ong.i%e 'bShortDate 'b0ongDate

upport Training

+icrosoft Confidential

:ove!ber -$&#

Properties

9#

Ob8ects &ounding Strings

Script Engine $dentification

'b.ristate+alse 'b.ristateMi2ed 'b.ristate.rue 'b.ristate:seDefault Dictionary +ileSyste%Ob8ect .e2tStrea% &ound +ilter $nstr&e' ?oin &eplace Split Str&e'erse ScriptEngine ScriptEngineBuildVersion ScriptEngineMa8orVersion ScriptEngineMinorVersion

; <==> Microsoft "orporation* All rights reser'ed*

upport Training

+icrosoft Confidential

:ove!ber -$&#

Vous aimerez peut-être aussi