What is ADO ?

Posted by Aamir Hasan on ASP.net Weblogs See other posts from ASP.net Weblogs or by Aamir Hasan
Published on Sat, 06 Mar 2010 06:34:00 GMT Indexed on 2010/03/08 7:08 UTC
Read the original article Hit count: 635

Filed under:

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

The common way to access a database from inside an ASP page is to:

  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



Example

 <%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open(Server.Mappath("/db/northwind.mdb"))
set rs = Server.CreateObject("ADODB.recordset")
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 & "<br />")
    next
    Response.Write("<br />")
    rs.MoveNext
loop

rs.close
conn.close
%>

 

© ASP.net Weblogs or respective owner

Related posts about ASP.NET