Connecting ASP Pages to MS Access Databases

This section describes steps of connecting ASP script pages to an MS Access database directly without using ODBC.

Connecting an ASP page to an MS Access database is relatively simple:

1. Create a MS Access database file with a table inside. And enter some data in the table.

2. Move the MS Access file to a your Web server.

3. Create an ADODB.Connection object in your ASP page. And link the object to the MS Access file with the Open() method:

   Set oConn = Server.CreateObject("ADODB.Connection")
   oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=access_file"

where "access_file" is the full path name pointing the MS Access file. There is no need to define a Data Source name with ODBC.

4. Prepare a SQL select statement. And execute the select statement through the connection object.

5. Loop through the execution result object to retrieve data returned from the select statement.

6. Output the retrieved data to the Web page.

7. Close the result object and the connection object.

Table of Contents

 About This Book

 ASP (Active Server Pages) Introduction

 IIS (Internet Information Services) 5.0

 MS Script Debugger

 VBScript Language

 ASP Built-in Run-time Objects

 ASP Session

 Creating and Managing Cookies

 Managing Sessions with and without Cookies

 scrrun.dll - Scripting Runtime DLL

 Managing Response Header Lines

 Calculation Speed and Response Time

 ADO (ActiveX Data Object) DLL

Working with MS Access Database

Connecting ASP Pages to MS Access Databases

 "hello_access.asp" - MS Access Example

 Persisting Data to MS Access Databases

 Running "insert_access.asp"

 Protecting Data in SQL Statements

 Protecting Data in SQL Statements - Test Script

 Guest Book Application Example

 References

 Full Version in PDF/EPUB