Database Connectivity What is ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a Microsoft Active-X component.

Slides:



Advertisements
Similar presentations
Basics of Database Programming with VB6
Advertisements

CIS 375—Web App Dev II ADO I. 2 Introduction ADO (________ Data Objects) is a Microsoft technology for accessing data in a database. ADO is automatically.
Mark Dixon Page 1 17 – Persistent data storage: relational databases and ADO.
Mark Dixon, SoCCE SOFT 131Page 1 24 – Web applications: Writing data to Databases using ASP.
1 Chapter 12 Working With Access 2000 on the Internet.
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
ASP Application Development Session 3. Topics Covered Using SQL Statements for: –Inserting a tuple –Deleting a tuple –Updating a tuple Using the RecordSet.
The ADO Data Control. Universal Data Access Open Database Connectivity (ODBC) –standard for accessing data in databases OLE-DB –allows access to data.
ActiveX Data Object ISYS 562. ADO An ActiveX control ActiveX is build upon COM, a contract that defines a standard interface by which objects communicate.
 ADO Object Model  Database Connection  Record Set  Query Examples  Update & Insertion Examples  An Application Example Working with Database in.
1 Active Server Pages Active Server Pages (ASPs) are Web pages ASP = server-side scripts + HTML The appearance of an Active Server Page depends on who.
4/8/99 C. Edward Chow Page 1 Active Server Page It is a server-side scripting environment for creating dynamic content. ASP are files with.asp extension,
Database Connectivity Session 2. Topics Covered ADO Object Model Database Connection Retrieving Records Creating HTML Documents on-the-fly.
CSE 190: Internet E-Commerce Lecture 13: Database code.
4/8/99 C. Edward Chow Page 1 Internet Services Manager Click Start | Programs | Administrative Tools | Internet Services Manager.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
ASP & ADO. Connection Object An implicit connection is created when we open a recordset without a connection object. –rs.open “Customer”, "DSN = Sales”
DT221/3 Internet Application Development Active Server Pages & Database Connection.
DAT702.  Standard Query Language  Ability to access and manipulate databases ◦ Retrieve data ◦ Insert, delete, update records ◦ Create and set permissions.
How to using MS Access database in Perl/CGI Web Programming Wei Sun.
CIS 270—App Dev II Big Java Chapter 22 Relational Databases.
PHP Programming. Topics Background and History of PHP Installation Comments in PHP Variables Conditions Loops Functions File Handling Database Handling.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
1 Lecture 3 Web Technologies Part 2. 2 l HTML l XHTML l CSS l XML l JavaScript l VBSCRIPT DOM l DHTML l AJAX l E4X l WMLScript l SQL Web Technologies.
Interacting With Data Week 8 Connecting to the database Creating recordsets Interacting with the database.
Interacting With Data Databases.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Advanced Database Management System Lab no. 11. SQL Commands (for MySQL) –Update –Replace –Delete.
ADO Connect Y.-H. Chen International College Ming-Chuan University Fall, 2004.
Chapter 7 PHP Interacts with Ms. Access (Open DataBase Connectivity (ODBC))
ActiveX Data Object (ADO) in JavaScript J.L.Wang, Yen-Cheng Chen Dept. of Infomation Management Ming-Chuan University Jan
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
Database 20/2/12 Connection. 
Database Processing with JSP ISYS 350. Example: Enter CID in a box and retrieve the customer record.
Server Side Programming ASP1 Server Side Programming Database Integration (cont.) Internet Systems Design.
Mark Dixon Page 1 23 – Web applications: Writing data to Databases using ASP.
Web Server Administration Chapter 7 Installing and Testing a Programming Environment.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
Relational Databases Database Driven Applications Retrieving Data Changing Data Analysing Data What is a DBMS An application that holds the data manages.
Introduction to ADO Y.-H. Chen International College Ming-Chuan University Fall, 2004.
Lecture Note 10: Simple Database Techniques. Introduction –Database System –Access, SQL Server and others. –Microsoft Access - Interacting with this databases.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
What is database?  Any Method for access info into Application from DataBase?  ODBC is standard for Accessing Data.  Problem with ODBC:  Information.
How to Connect to Database ODBC (Open Database Connectivity) ADO (ActiveX Data Object) ASP Code To Connect to Database Recordset Object Navigating through.
1 Database Systems Introduction to Microsoft Access Part 2.
AVCE ICT – Unit 7 - Programming Session 16 – Database and VB.
Mark Dixon, SoCCE SOFT 131Page 1 23 – Web applications: Databases & ASP.
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
Lab 8 Data Access Using Microsoft ActiveX Data Object (ADO)
PHP Programming. Topics Database Handling (MySQL, MSSQL, ODBC)
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
What’s new in ADO 2.5 Greg Hinkel Program Manager Data Access Group
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 6: Accessing a database with PHP Rob Gleasure robgleasure.com.
Labtest.ASP Notes. INSERT STATUS INSERT STATUS
Using databases ActiveX Data Objects (ADO) Connecting to a database Reading data from a database Inserting, updating and deleting records Using databases.
Chapter 5 Building Your Product Catalog database Objectives Create Database. Create Table. Connect to Database. Use ASP Script to add new products. Use.
 2 Data Object Library approaches ◦ DAO (Data Access Objects)  Original access strategy (up to VB6)  Closely linked to MS Access ◦ ADO (ActiveX Data.
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
ASP.NET Programming with C# and SQL Server First Edition
MATLAB DATABASE Configuration
, MS-Access, QBE, Access/Oracle
Working with Database in ASP
VISUAL BASIC INTRODUCTION TO DATA CONNECTIVITY.
Chapter 10 ASP and Data Store Access
Go to PC1.
Chapter 10 ADO.
What’s new in ADO Greg Hinkel Program Manager Data Access Group
Database Connections.
ASP Database Operations
Presentation transcript:

Database Connectivity What is ADO

What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a Microsoft Active-X component ADO is automatically installed with Microsoft IIS ADO is a programming interface to access data in a database

Accessing a Database from an ASP Page 1. Create an ADO connection to a database 2. Open the database connection 3. Create an ADO recordset 4. Open the recordset 5. Extract the data you need from the recordset 6. Close the recordset 7. Close the connection

1&2. ADO Database Connection Create a DSN-less Database Connection

Create an ODBC Database Connection An ODBC Connection to an MS Access Database Open the ODBC icon in your Control Panel. Choose the System DSN tab. Click on Add in the System DSN tab. Select the Microsoft Access Driver. Click Finish. In the next screen, click Select to locate the database. Give the database a Data Source Name (DSN). Click OK.

3&4. ADO Recordset To be able to read database data, the data must first be loaded into a recordset. Create an ADO Table Recordset

Create an ADO SQL Recordset

Extract Data from the Recordset

Definitions The ADO Connection Object: The ADO Connection object is used to create an open connection to a data source. Through this connection, you can access and manipulate a database. The ADO Recordset Object :The ADO Recordset object is used to hold a set of records from a database table.

Operations List, Add, Update, and Delete Database Records

Display the Field Names and Field Values <% set conn=Server.CreateObject("ADO DB.Connection") conn.Provider="Microsoft.Jet.OLE DB.4.0" conn.Open "c:/webdata/northwind.mdb" set rs = Server.CreateObject("ADODB.rec ordset") rs.Open "SELECT * FROM Customers", conn do until rs.EOF for each x in rs.Fields Response.Write(x.name) Response.Write(" = ") Response.Write(x.value & " ") next Response.Write(" ") rs.MoveNext loop rs.close conn.close %>

Add a Record to a Table in a Database <% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "c:/webdata/northwind.mdb" sql="INSERT INTO customers (customerID," sql=sql & "name,address)" sql=sql & " VALUES " sql=sql & "('" & Request.Form("custid") & "'," sql=sql & "'" & Request.Form("name") & "'," sql=sql & "'" & Request.Form("address") & "')" on error resume next conn.Execute sql, recaffected if err<>0 then Response.Write("No update permissions!") else Response.Write(" " & recaffected & " record added ") end if conn.close %>

Update a Record in a Table Update Record <% set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "c:/webdata/northwind.mdb" cid=Request.Form("customerID") sql="UPDATE customers SET " sql=sql & "name='" & Request.Form("name") & "'," sql=sql & "address='" & Request.Form("address") & "'," sql=sql & " WHERE customerID='" & cid & "'" on error resume next conn.Execute sql if err<>0 then response.write("No update permissions!") else response.write("Record " & cid & " was updated!") end if end if conn.close %>

Delete a Record in a Table Delete Record 0 then response.write("No update permissions!") else response.write("Record " & cid & " was deleted!") end if end if conn.close %>

Multiple Response.Write's For a large query, this can slow down the script processing time, since many Response.Write commands must be processed by the server.

Alternative speed up way The solution is to have the entire string created, from to, and then output it - using Response.Write just once. str = rs.GetString(format,rows,coldel,rowdel,null expr)

coldel - the HTML to use as a column- separator rowdel - the HTML to use as a row- separator nullexpr - the HTML to use if a column is NULL

"," "," ") %>