1 / 16

Data Access Using Active Server Page (ASP)

ECMM 6010: TERM PAPER PRESENTATION. Data Access Using Active Server Page (ASP). Sagar Thulung (B00349076) MEC Candidate. Table of content. ASP Introduction Requirement Basic of ASP coding Introduction to some of the ASP objects Accessing data store Connecting string

velma
Download Presentation

Data Access Using Active Server Page (ASP)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ECMM 6010: TERM PAPER PRESENTATION Data Access UsingActive Server Page (ASP) Sagar Thulung (B00349076) MEC Candidate “Data Access Using ASP” Sagar Thulung

  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 “Data Access Using ASP” Sagar Thulung

  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. “Data Access Using ASP” Sagar Thulung

  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 “Data Access Using ASP” Sagar Thulung

  5. Basic of ASP coding • Enclosed between delimiters “<%” and “%>” • <% @Language=VBScript %> • <% Response.Write “Presentation.” %> equivalent to <% =output %> Diagram 1 Request Scripting engine Server Client Response “Data Access Using ASP” Sagar Thulung

  6. Introduction to some of ASP object Request object: The FORM collection . Contains all information that the client has sent • <% = Request.Form(“name”) %> or • <% customer_name = Request.Form(“name”) %> The customer name: <% =customer_name %> <FORM METHOD=“post” ACTION=“try.asp”> Name: <INPUT name=“name” type=“text” maxlength=“15”> <INPUT type=“submit” value=“Submit”> </FORM> “Data Access Using ASP” Sagar Thulung

  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 • <% =value %> 2. The Redirect method • Directly redirect to the page mentioned in URL • Syntax • Response.Redirect URL “Data Access Using ASP” Sagar Thulung

  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 “Data Access Using ASP” Sagar Thulung

  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. “Data Access Using ASP” Sagar Thulung

  10. Connection to database [2] • <% ‘create a connection object set con = Server.CreateObject(“ADODB.connection”) ‘open connection con.open “PROVIDER=MICROSOFT.JET.OLEDB.4.0.;” “Data source=database extension” %> “Data Access Using ASP” Sagar Thulung

  11. Executing query • SQL statement (INSERT, UPDATE, DELETE, SELECT) • Execute method • <% SQL = “INSERT INTO table_name (att1, att2) VALUES(‘text1’,’text2’)” con.execute SQL %> • DELETE: remember • It Delete’s all rows from the table • Give WHERE clause • http://www.websamba.com/sagar_asp/form.html “Data Access Using ASP” Sagar Thulung

  12. Manipulating RecordSet Object [2] • Retrieve data • Display data • <% 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 %>&nbsp;<%rs(“name”) %> &nbsp; <%=rs(“add”)%> rs.movenext LOOP rs.close con.close • http://www.websamba.com/sagar_asp/form.html “Data Access Using ASP” Sagar Thulung

  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 “Data Access Using ASP” Sagar Thulung

  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 “Data Access Using ASP” Sagar Thulung

  15. References (1) Chris Ullman; Beginning ASP 3.0; Wrox Press; 1999. (2) http://www.webwizguide.com/asp/tutorials/add_to_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 “Data Access Using ASP” Sagar Thulung

  16. Question ? “Data Access Using ASP” Sagar Thulung

More Related