Presentation is loading. Please wait.

Presentation is loading. Please wait.

INT213 INT213 – Managing Windows with VBScript VBScript Variables ASP State Management.

Similar presentations


Presentation on theme: "INT213 INT213 – Managing Windows with VBScript VBScript Variables ASP State Management."— Presentation transcript:

1 INT213 INT213 – Managing Windows with VBScript VBScript Variables ASP State Management

2 INT213 Week 2INT2132 Agenda VBScript Variables in VBScript ASP State Management in ASP On-Line Resources: –http://library.senecacollege.ca/index.htmlhttp://library.senecacollege.ca/index.html > Remote Access to Research Resources > Research Databases > Books 24x7 and Safari Tech Books Online

3 INT213 VBScript Questions: What is VBScript? Scripting vs. Compiled Languages?

4 INT213 VBScript Variables Questions: What is a Variable?

5 INT213 Week 2INT2135 VBScript Variables Dim keyword to declare variables Dim x Dim x, y, z vs. Dim x Dim y Dim z Dim x = 7 ‘ ERROR!

6 INT213 Week 2INT2136 Naming Variables 1.Begin with alpha: strNameSome_ThingFruit +strName99Red@Test 2.Follow with alphanumeric or _ : Two_WordsTwoWordstwowords 3.Don’t use VBScript keywords 4.Keep names Short (255 or less) but Clear: 5.Names are NOT case sensitive

7 INT213 Week 2INT2137 Literals, Variables, Constants Literals WScript.Echo “Hello World” MsgBox #5/16/05 1:30 PM# Response.Write 3 Variables Dim x x = “INT213” WScript.Echo x Constants Const DRIVE_FULL = 10005 Const NO_DISK = 10006 x = DRIVE_FULL ‘ x = 10005

8 INT213 Week 2INT2138 Option Explicit Declaring Variables is optional. So why bother? lngFirst = 1 lngSecond = 2 lngThird = lngFirst + lngSecond MsgBox “Answer is “ & lngThird vs. lngFirst = 1 lngSecond = 2 lngThird = lngFirst + lgnSecond MsgBox “Answer is “ & lngThird

9 INT213 ASP Questions: What is ASP? How does VBScript relate to ASP?

10 INT213 Week 2INT21310 ASP <% Option Explicit Dim course course = “INT213” %> ASP Sample You are taking the following courses: Course : ”) Response.Write(course) Response.Write(“ ”) %>

11 INT213 Week 2INT21311 ASP Intrinsic Objects Response –Output to Client Request –Input from Client Server –Access properties/functions of the Web Server Session –Memory for variables associated with EACH client Application –Memory for variables associated with ALL clients

12 INT213 Week 2INT21312 Response Object Output to client browser Redirect client at Server Side to new page Set client Cookies (do this BEFORE …)

13 INT213 Week 2INT21313 Request Object Read Form Variables Read Cookie values Read Query String values Read Server Variables <% ip = _ Request.ServerVariables(“REMOTE_ADDR”) %>

14 INT213 Week 2INT21314 Session and Application Objects Create a Session Variable for a client Read a Session Variable for a client <% Dim chosenColour chosenColour = Session(“colour”) %> Work with Variables for ALL clients to a Web App <% Application(“cnt”) = _ Application(“cnt”) + 1 %>


Download ppt "INT213 INT213 – Managing Windows with VBScript VBScript Variables ASP State Management."

Similar presentations


Ads by Google