Server-side programming - ASP - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

Server-side programming - ASP

Description:

An ASP page is an HTML page interspersed with server-side. code. ... VBScript. JavaScript. ActiveX Scripting. Engines. ASP File. HTTP Request. HTTP Response ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 11
Provided by: cms98
Category:

less

Transcript and Presenter's Notes

Title: Server-side programming - ASP


1
Session 6
  • Server-side programming - ASP

2
What is ASP?
  • An ASP page is an HTML page interspersed with
    server-side
  • code.
  • The .ASP extension instead of .HTM denotes
    server-side code
  • to the hosting Web server.
  • You can use any text editor to create or change
    an ASP file

Sets the default for the page
lt_at_LANGUAGE "JavaScript"gt lt var varSurname
Request.form("surname") gt lthtmlgt ltbodygt lt sql
"Select from tblStock" gt THIS IS
HTML Surname ltvarSurnamegt
Gets data from form on previous page
The ASP is between lt and gt
Outputs the variables content
3
Open Database Connectivity(ODBC)
These databases know how to interact with ODBC
  • ODBC is an intermediary technology that allows
    databases made by different manufacturers to
    communicate with different interfaces e.g. ASP
    pages.
  • The web server has ODBC drivers installed upon it
    which interpret the dialogue into a common
    language that each database understands.

Adapted from Resselman, 2000
4
Browsers
  • Display data primarily in HTML format.
  • Accept user input from HTML form elements
  • ASP pages are a mixture of hard-coded HTML (menu
    bars, other static page content) and dynamically
    generated HTML.
  • ASP (operating at the server-side) must therefore
    send the data from the server to the client in
    HTML format. All the calculations for doing this
    are performed at the server side, using the
    server's processor.

5
Client
HTTP Request
Web Server
HTTP Response
Components
VBScript
IIS
ActiveX Data Objects (ADO)
JavaScript
ActiveX Scripting Engines
Database
ASP File
6
Stages for ASP
  1. Client requests ASP page from server
  2. HTML and script code are separated.
  3. Script code is parsed, syntax checked and
    compiled by Web server by appropriate scripting
    engine
  4. Code is executed by the appropriate scripting
    engine
  5. Script output and static HTML code are merged
  6. Final HTML is sent back to the user

7
Anatomy of an .asp Page
lthtmlgt ltheadgt lt/headgt ltbodygt lt/bodygt lt/htmlgt
Note the code appears where the data will be
output on screen.
8
Returning Records from a DB Using ASP
  • Open a connection to the database, using the
    connection object.
  • Create a query string variable containing the SQL
    for the query.
  • Create a recordset object, then run the query on
    it.
  • Loop through the records and format and display
    each as HTML.

9
lt_at_ LANGUAGE"JAVASCRIPT" gt lt myconn
CreateObject("ADODB.Connection") rs
CreateObject("ADODB.Recordset") myDB
"DriverMicrosoft Access Driver
(.mdb)DBQe\\webareas\\sr65\\sdg.mdb"
10
sql "Select from tblStock order by
Stock_id" rsmyconn.Execute(sql) while (!
rs.eof) gt Item ltrs("Description")gtltbr
/gt lt rs.MoveNext rs.Close gt
Write a Comment
User Comments (0)
About PowerShow.com