0% found this document useful (0 votes)
39 views14 pages

Server Pages (ASP)

Active Server Pages (ASP) can be used to access databases. ADO (ActiveX Data Objects) is a Microsoft technology that provides an interface to access data in databases. The main steps for accessing a database using ADO are: 1) create an ADO connection, 2) open the connection, 3) create an ADO recordset, 4) open the recordset, 5) extract the needed data, 6) close the recordset, and 7) close the connection. ADO consists of connection, recordset, command, and error objects that have properties and methods used to connect to and interact with databases.

Uploaded by

jvijayfinance
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views14 pages

Server Pages (ASP)

Active Server Pages (ASP) can be used to access databases. ADO (ActiveX Data Objects) is a Microsoft technology that provides an interface to access data in databases. The main steps for accessing a database using ADO are: 1) create an ADO connection, 2) open the connection, 3) create an ADO recordset, 4) open the recordset, 5) extract the needed data, 6) close the recordset, and 7) close the connection. ADO consists of connection, recordset, command, and error objects that have properties and methods used to connect to and interact with databases.

Uploaded by

jvijayfinance
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 14

Active Server Pages (ASP)

Session 76
Connecting to data with ASP
Accessing a Database from an ASP Page
 ADO can be used to access databases from your web
pages
 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
To access a database
 Steps
 Create an ADO connection to a database
 Open the database connection
 Create an ADO recordset
 Open the recordset
 Extract the data you need from the recordset
 Close the recordset
 Close the connection
ADO - Objects
 ADO consists of four objects with their corresponding
properties and methods.
1. Connection
a. Methods
i. Open
ii. Execute
iii. Close
ADO -Objects
2. Recordset
a. Properties
i. bof
ii. eof
b. Methods
i. Open
ii. Movefirst
iii. Movenext
iv. Close
ADO -Objects
3. Command
a. Properties
i. Commandtext
b. Method
i. Execute
4. Error
a. Properties
i. count
ii. item
ADO - Connection
 There are 3 types of connections
1. ODBC DSN
2. ODBC DSN-less
3. OLE DB
ODBC DSN
 ODBC(Open Database Connectivity) is an open
standard developed in 1990's.
 It provides simple programming interface to relational
databases.
 DSN(Data Source Name) is a saved entry in Windows
ODBC applet
 which defines all connection information
 and provides a simple name to handle connectivity.
 Syntax of connection through ODBC DSN
conn.open "DSN=DSNname;" & "Uid=Username;"
& "Pwd=Password;"
ODBC DSN-less
 This connection also uses ODBC, but does not use a
saved DSN entry.
 Advantages of using this type of connection
 saves a call to the Windows Registry because of the
quickness of its service
 Avoid having to have the DSN created on the web
server.
 More portable
 More flexible and can pass database names as
variables.
ODBC DSN-less
 The syntax is

conn.open "Driver={Microsoft Access Driver


(*.mdb)};" & "Dbq=" &
server.mappath("nameofdb.mdb") & ";" &
"Uid=Username;" & "Pwd=Password;"
OLE DB
 Microsoft standard
 Supported only on Microsoft operating systems.
 Provides access to relational and non-relational data.
 OLE DB (Object Linking and Embedding, Database), is an
API designed by Microsoft for accessing different types of
data stored in a uniform manner.
 It is a set of interfaces implemented using the Component
Object Model(COM);
Syntax
 The syntax

Dim Conn
Set Conn =
Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=msdaora;"
"Data Source=PSTDB;" & "User Id=username;" &
"Password=password;"
Retrieving Data from the Table
 Student table

Student (name, id, address, email, branch)

 Demo for retrieving data from the student table


 Demo for inserting a record into the table- student

You might also like