By “FlyingBono” 2009_02By FlyingBono.  ASP code is embedded in HTML using tags.  A ASP scripting block always starts with.  Server scripts are executed.

Slides:



Advertisements
Similar presentations
Chapter 41 Variables and JSP Control Structures JavaServer Pages By Xue Bai.
Advertisements

1 PHP Statement Constructs Server Scripting. 5-2 Basic Statement All Statements end in a semicolon. Statements are delimited from the HTML code by enclosing.
Basic Scripting in VBScript  VBScript must enclosed by  No HTML code is allowed inside a VBScript code block  Nested scripting block is not allowed.
JavaScript, Third Edition
VB .NET Programming Fundamentals
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
5.05 Apply Looping Structures
Day 4 Objectives Constructors Wrapper Classes Operators Java Control Statements Practice the language.
NMED 3850 A Advanced Online Design January 26, 2010 V. Mahadevan.
2440: 211 Interactive Web Programming Expressions & Operators.
Chapter 3: Data Types and Operators JavaScript - Introductory.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
November 2003Bent Thomsen - FIT 6-11 IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
Access VBA Programming for Beginners - Class 2 - by Patrick Lasu
4 1 Array and Hash Variables CGI/Perl Programming By Diane Zak.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Open Source Software Unit – 3 Presented By Mr. R.Aravindhan.
Variables,Constants and Data types Variables temporarily stores values during the execution of an application Variables have a name and data type Declare.
VBScript Language. What is VBScript Based on the Visual Basic family of languages Supports object oriented features Interpreted Loosely Typed Implicitly.
COMPUTER PROGRAMMING I 5.05 Apply Looping Structures.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
EIW - ASP Introduction1 Active Server Pages VBScript.
VARIABLES, CONSTANTS, OPERATORS ANS EXPRESSION
CNS 1120 Exam 1 Review. Programming Language Elements Syntax = the rules to follow Syntax = the rules to follow Semantics = the meaning of symbols Semantics.
Introduction to ASP.NET Please use speaker notes for additional information!
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Chapter 3 Control Structures. The If…Then Statement The If…Then statement is a Decision statement = that executes a set of statements when a condition.
Introduction to Programming Lecture Note - 2 Visual Basic Programming Fundamentals.
Visual Basic Programming I 56:150 Information System Design.
CSI 3125, Preliminaries, page 1 Data Type, Variables.
CIVIL AND GEOMATIC ENGINEERING FT Okyere. CIV 257- COMPUTER PROGRAMMING Lecture 3.
CECS 5020 Computers in Education Visual Basic Variables and Constants.
CN2180 Chapter 4 Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP Kemtis Kunanuraksapong MSIS with Distinction, A+ MCTS, MCDST, MCP.
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Internet & World Wide Web How to Program, 5/e © by Pearson Education, Inc. All Rights Reserved.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Chad’s C++ Tutorial Demo Outline. 1. What is C++? C++ is an object-oriented programming (OOP) language that is viewed by many as the best language for.
PHP Tutorial. What is PHP PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Welcome to Computer Programming II! Computer Programming II Summer 2015.
INT213 – WEEK 1 ASP tags and comments Variables, Constants, and "Literals" Simple Output.
PHP using MySQL Database for Web Development (part II)
VISUAL BASIC 6.0 Designed by Mrinal Kanti Nath.
Egyptian Language School Computer Department
>> Introduction to JavaScript
A variable is a name for a value stored in memory.
VB Script V B S.
VBA - Excel VBA is Visual Basic for Applications
VBScript Session 1 IT Professional Academy.
Visual Basic 6 (VB6) Data Types, And Operators
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
JavaScript Syntax and Semantics
Development of Internet Application 1501CT - Sara Almudauh
JavaScript.
Arrays, For loop While loop Do while loop
Chapter 6 Variables What is VBScript?
PHP.
CSI 101 Elements of Computing Spring 2009
Logical Operations In Matlab.
HYPERTEXT PREPROCESSOR BY : UMA KAKKAR
PHP an introduction.
ASP control structure BRANCHING STATEMENTS
Quick Test Professional Training Part 1
Web Programming and Design
SEEM 4540 Tutorial 4 Basic PHP based on w3Schools
Presentation transcript:

By “FlyingBono” 2009_02By FlyingBono

 ASP code is embedded in HTML using tags.  A ASP scripting block always starts with.  Server scripts are executed on the server, and can c ontain any expressions, statements, procedures, or operators valid for the scripting language you prefer to use. Format 2009_02By FlyingBono

 response.write :  used to write output to a browser  The following example sends the text "Hello A SP" to the browser. View the Output Page 2009_02By FlyingBono

 Variable  Assigning values in ASP is straightforward enough, just use the equals "=" operator.  If the variable is declared outside a procedure it can be changed by any script in the ASP file. If the variable is declared inside a pr ocedure, it is created and destroyed every time the procedure is executed.  Can use without declaring variables  Option Explicit statement ▪ Used to force explicit declaration of all variables in that script Format Dim Variable Example Dim strName 2009_02By FlyingBono

 The Rule of Variables  Variable name must start with an alphabetic character  Variables must not start with a number.  Variables cannot contain a period, special characters.  Variables can contain letters, _, and numbers.  Variables cannot be longer than 255 characters AvailablestrName, strName123, strName_123, _strName Disavailablestr!Name, 123strName, strName~123, ~strNam 2009_02By FlyingBono

 Const  The const keyword is used to create a read only variable.  Once initialized, the value of the variable cannot be chang ed but can be used just like any other variable. Format Const const_name = value Example Const MaxNumber = _02By FlyingBono

 Data types in ASP  Just one data type called variant ▪ This special data type can act like any type that you can create as well as an object data type. ▪ When you place a value in a variant data type, it decides for you how the value should be stored. 2009_02By FlyingBono

 Number type TypeRange Integer Integer from -32,768 to 32,767 Long Integer from -2,147,483,684 to 2,147,483,647 Byte Integer 0 to 255 Single Negative number from E38 to E-45 Double Negative number from E308 to E- 324 Currency -922,337,203,685, ∼ 922,337,203,685, _02By FlyingBono

 Character type  Date type  Boolean type  Store a value of ‘True’ or ‘False’  Automatically, change the value as ‘-1’ or ‘0’ FormatVariable_name = “characters” ExamplestrName = “Mr.Kim” FormatVariable_name = # date # ExamplestrTime = # 04/01/2009 # 2009_02By FlyingBono

 This example demonstrates  How to declare a variable  How to assign a value to it  How to use the value in a text View the Output Page 2009_02By FlyingBono

 Arithmetic operators  Comparison operators OperatorDescription =Equal To <Less Than >Greater Than <=Less Than Or Equal To >=Greater Than Or Equal To <>Not Equal To OperatorEnglish +Addition -Subtraction *Multiplication /Division ^Exponential ModModulus -Negation \Integer Division 2009_02By FlyingBono

 Logical operators  String operator OperatorDescription AND Both Must be T RUE OR One Must be TR UE NOT Flips Truth Valu e XOR One or the othe r but not both OperatorDescription &String Concatenation 2009_02By FlyingBono

 Comments are skipped by the compiler.  Using for denoting comment in HTML  Using ‘(single-quote) for denoting comment in ASP  Once starting a line as a comment, the whole line must be a comment. 2009_02By FlyingBono

View the Output Page 2009_02By FlyingBono

 A data structure consisting of a group of elements that are accessed by indexing.  Type of Arrays  Fixed-sized arrays (static arrays)  Dynamic arrays  Multi-dimensional arrays 2009_02By FlyingBono

 Fixed-sized arrays (static arrays)  These size cannot change once their storage has been allocated.  Using a Dim keyword for declaration like variables  ‘( num )’ is used to set array sizes Format Dim Array_name (number) Example Dim strMember(2) 2009_02By FlyingBono

 Dynamic arrays  These arrays can be resized.  Using a Dim keyword for declaration like variables  ‘()’ is used to declare arrays  Using a ReDim keyword for allocating or reallocating storage space Format Dim Array_name () ReDim Array_name(number) Example Dim strMember() ReDim strMember1(3) 2009_02By FlyingBono

 Multi-dimensional arrays  An array that contains at least one other array as the value of one of the indexes  Using a Dim keyword for declaration like variables  ‘( num, num )’ is used to set array sizes Format Dim Array_name (number, number) Example Dim strMember(2, 2) 2009_02By FlyingBono

View the Output Page 2009_02By FlyingBono

 If Else  Can execute a set of code depending on a condition Format If condition then statement1, code to be executed if condition is true Else statement2, code to be executed if condition is false End If Example If intScore = 1 Then Response.Write “You are a member." Else Response.Write “You are not a member." End If 2009_02By FlyingBono

 at times you will want to check for multiple conditions, using a ElseIf Format If condition1 then statement1 ElseIf condition2 then statement2 Else statement3 End If Example If intScore = 1 Then Response.Write “You are a member." Elseif intScore = 2 then Response.Write “You are not a member." Else Response.Write “Goodbye.” End If 2009_02By FlyingBono

View the Output Page 2009_02By FlyingBono

 Select Case  Checking for multiple is equ al to conditions of a variable  Case Else ▪ This case is actually a catch all option for every case that does not fit into the defined cases. ▪ In other words, if all these case s don't match then using the "C ase Else" Format Select Case Condition Case value1 Statement1 Case value2 Statement2 Case Else Statement3 End Select Example Select Case strScore Case “Gold” Response.Write “Gold” Case “Silver” Response.Write “Oops” Case Else Response.Write “Bye” End Select 2009_02By FlyingBono

View the Output Page 2009_02By FlyingBono

 For Loop  A For Loop is used for special situations when you need to do something over and over again until some condition statement fails. Format For Initial To Max Step Increasement Statement Next Example For i = 1 To 10 Step 1 Response.Write “Your visit number is” & I & " " Next 2009_02By FlyingBono

 For Each Loop  For Each Loop is useful when you want to go through every element in an array, but you do not know how many elements there are inside the array. Format For Each element In array Statement Next Example For Each strItem In strBuy Response.Write strItem & " " Next 2009_02By FlyingBono

View the Output Page 2009_02By FlyingBono

 Do Loop  The Do Loop structure repeats a block of statements until a specified condition is met.  There are three types of Do Loop, Do Until, and Do While. Format 1 Do While condition Statement Loop Example Do While intCount < 10 Response.Write “number : " & intCount “ " intCount = intCount + 1 Loop 2009_02By FlyingBono

Format 3 Do Until condition Statement Loop Example Do Until counter=0 Response.Write("The counter is: "&counter&" ") counter=counter-1 loop Format 2 Do Statement Loop condition Example Do Response.Write("The counter is: "&counter&" ") counter=counter-1 loop until counter =0 2009_02By FlyingBono

View the Output Page 2009_02By FlyingBono

 A procedure is a specified series of actions, acts or operations which have to be executed in the same manner.  Sub Procedures  Function 2009_02By FlyingBono

 Sub Procedures  ASP Sub Procedures are a collection of ASP statements that perform a task, and are executed by an event procedure.  Event Procedures are any clickable objects, or onload event.  Sub procedures do not return a value, but executes it's content on "call". 2009_02By FlyingBono

Format Sub procedure_name() Statement End Sub Sub procedure_name(argument) Statement End Sub Example Sub GetInfo() dim name,telephone,fee name="Mr. John Doe" phone=“0251" fee=20 Response.write("Name: "& name &" ") Response.write(“Phone: "& phone &" ") Response.write("Fee: "& fee &" ") End Sub GetInfo() Sub circle(r) dim pi,area,diameter,circum pi=3.14 area=pi*r^2 diameter=2*r circum=2*pi*r Response.write("The radius of Circle "&r&" has the area of: "&area) Response.write(", the diameter of: "&diameter&" and a circumference of: "&circum) End Sub 2009_02By FlyingBono

View the Output Page 2009_02By FlyingBono

 Functions  Function procedures are similar to a 'Sub procedure', but can also return a value. Format Function function_name() Statement End Function Function function_name(argument) Statement End Function Example Function userName() userName = "MaryLou" End Function Function total(price) dim tax tax=price*.09 total=price + tax End Function 2009_02By FlyingBono

View the Output Page 2009_02By FlyingBono