ASP using ADO
This lesson will provide a brief overview of what the use of ADO is, and why it is necessary to program the Repertoire in ASP. ADO technology supports ActiveX Data objects. An ActiveX Data object is a collection of parts that can be used in an ASP program.
Accessing the database
ADO technology is specifically used as a means of communication and manipulating databases. This type of database ADO technology allows you to interact with ASP programs including access, MySQL and databases, and so on. In this lesson, we will connect to an Access database, so you will need to get access (hop) to complete this lesson.
To create your Access database
Before you can connect to an Access database, you must first create an Access database file. Fire your copy of Ms Access and build the following repositories:
Create a new, blank database called "Tizag.mdb" (without quotes) and save it to the "C:inetpub wwwroot tizagasp" (without quotes)
Use the wizard to create the database.
New Two-field table: First and last Name
Click Next
Name table "Tizagtable" (not including quotes)
Select "Yes, create a primary key for me"
Click Next
Click Finish
Now that we have our database are still connected to it.
Connect to an Access database by using ADO
Create an ASP file named "Tizagado.asp" and save it in the same directory as your Access database file.
In the following ASP code, we first set up an ADO database connection, and then we set up the ConnectionString, and finally we call the Open method with our Access database file to complete the open process.
Come on, let's see the simple.
<%
Dim myconn
Set myconn = Server.CreateObject ("ADODB. Connection ")
MyConn.Open = (" Driver={microsoft Access "&_
" DRIVER (*.mdb)};D bq= "&_ "C:inetpubwwwroottizagasptizag.mdb")
Myconn.close ()
Set myconn = Nothing
%>