- PowerPoint PPT Presentation

About This Presentation
Title:

Description:

ASP is a server-side scripting environment that helps us to create and run ... (1) Chris Ullman; Beginning ASP 3.0; Wrox Press; 1999. ... – PowerPoint PPT presentation

Number of Views:50
Avg rating:3.0/5.0
Slides: 17
Provided by: csh96
Category:
Tags: wrox

less

Transcript and Presenter's Notes

Title:


1
Data Access UsingActive Server Page (ASP)
ECMM 6010 TERM PAPER PRESENTATION
  • Sagar Thulung
  • (B00349076)
  • MEC Candidate

2
Table of content
  • ASP Introduction
  • Requirement
  • Basic of ASP coding
  • Introduction to some of the ASP objects
  • Accessing data store
  • Connecting string
  • Connecting to database
  • Executing queries
  • Using Recordset object to manipulate results
  • Managing database connection
  • Summary
  • References

3
ASP introduction
  • ASP is a text file with extension .asp that
    contains combination of the following
  • text
  • HTML tags and,
  • ASP script commands
  • ASP is a server-side scripting environment that
    helps us to create and run dynamic, interactive
    web server applications.

4
Requirement
  • Text editor (notepad, Visual InterDev, )
  • Browser
  • Server (PWS, IIS)
  • Others
  • DBMS
  • Image editing tools
  • Limitation
  • - Limited to MS Win based platform
  • - PWS
  • Runs in Win 9X only
  • About 20 concurrent users only

5
Basic of ASP coding
  • Enclosed between delimiters lt and gt
  • lt _at_LanguageVBScript gt
  • lt Response.Write Presentation. gt
  • equivalent to
  • lt output gt

Diagram 1
Request
Scripting engine Server
Client
Response
6
Introduction to some of ASP object
  • Request object The FORM collection
  • . Contains all information that the client has
    sent
  • lt Request.Form(name) gt
  • or
  • lt customer_name Request.Form(name) gt
  • The customer name lt customer_name gt

ltFORM METHODpost ACTIONtry.aspgt Name
ltINPUT namename typetext maxlength15gt ltIN
PUT typesubmit valueSubmitgt lt/FORMgt
7
Introduction to some of ASP (contd )
  • Response object
  • 1. The Write method
  • Channel through which information can be passed
    back to the client
  • Syntax
  • Response.Write(data)
  • Alternate syntax
  • lt value gt
  • 2. The Redirect method
  • Directly redirect to the page mentioned in URL
  • Syntax
  • Response.Redirect URL

8
Accessing data store
  • Why?
  • Real world ? database
  • How?
  • Explanation
  • Steps
  • Connection string
  • Connecting to the database
  • Executing queries
  • Using Recordset Object for manipulating results

9
Terminology 1
  • Active Data Object (ADO)
  • Easy-to-use but extensible technology for adding
    database access to the web pages.
  • Adding database functionality to web application
  • OLEDB
  • System level programming interface that provides
    standard set of COM interfaces for exposing DBMS
    functionality.

10
Connection to database 2
  • lt
  • create a connection object
  • set con Server.CreateObject(ADODB.connection)
  • open connection
  • con.open PROVIDERMICROSOFT.JET.OLEDB.4.0.
  • Data sourcedatabase extension
  • gt

11
Executing query
  • SQL statement (INSERT, UPDATE, DELETE, SELECT)
  • Execute method
  • lt
  • SQL INSERT INTO table_name (att1, att2)
  • VALUES(text1,text2)
  • con.execute SQL
  • gt
  • DELETE remember
  • It Deletes all rows from the table
  • Give WHERE clause
  • http//www.websamba.com/sagar_asp/form.html

12
Manipulating RecordSet Object 2
  • Retrieve data
  • Display data
  • lt strcon connection string
  • set con Server.CreateObject(ADODB.Conenction)
  • con.open strcon
  • recordset object
  • set rs Server.CreateObject(ADODB.RecordSet)
  • open recordset
  • SQL SELECT name, add FROM EMP WHERE country
    Canada
  • rs.open SQL,con
  • cycle and display
  • DO UNTIL rs.eof
  • gtnbspltrs(name) gt nbsp ltrs(add)gt
  • rs.movenext
  • LOOP
  • rs.close
  • con.close
  • http//www.websamba.com/sagar_asp/form.html

13
Managing database connection
  • Strain database server resources when
  • kept open
  • sudden increase in activity and,
  • Connection delay.
  • Solution
  • 1. Timing out a connection
  • Default 30 sec
  • set con Server.CreateObject(ADODB.Connection)
  • con.ConnectionTimeout 20
  • 2. Closing connection
  • Reduce demand of database server
  • Con.close

14
Summary
  • Advantages/Features
  • Easy and fast way of developing non-static web
    pages
  • Shipped with built in functions
  • Use any scripting language (installed scripting
    engine follow the ActiveX Scripting standard)
  • Can store ASP file anywhere in server
  • HTML server side code unified
  • Built in the concept of COM
  • ASP basics
  • Connecting to data store
  • Executing query
  • Using RecordSet

15
References
  • (1) Chris Ullman Beginning ASP 3.0 Wrox Press
    1999.
  • (2) http//www.webwizguide.com/asp/tutorials/add_t
    o_database_pt2.asp
  • (3) Jeffrey P. McManus Database Access using
    Visual Basic SAMS publication 1998.
  • (4) http//www.aspin.com
  • (5) http//www.asptoday.com
  • (6) http//www.asp.net
  • (7) http//www.asp101.com

16
Question
  • ?
Write a Comment
User Comments (0)
About PowerShow.com