Connecting Classic ASP to Access with ADO

This tutorial preserves the original Classic ASP + Microsoft Access ADO example because it is still useful when maintaining older sites. For new server-side applications, prefer a server database such as SQL Server rather than designing a new web application around an Access .mdb/.accdb file.

Legacy/server-support note: Microsoft states that the Access Database Engine is not intended as a replacement for Jet in server-side applications. The ACE connection below is therefore shown as a legacy-compatibility example for environments where the provider is already installed and supported by the application owner. Verify provider availability, licensing/support and process bitness before relying on it.

Create and open an ADO Connection

Set objconn = Server.CreateObject("ADODB.Connection")
objconn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
  Server.MapPath("db/months.mdb")
objconn.Open

Server.MapPath() converts the site-relative database path into a physical server path. Keep writable Access database files outside publicly downloadable folders and grant only the IIS identity permissions the application actually needs.

Create a Recordset object

Set objRs = Server.CreateObject("ADODB.Recordset")

A Recordset represents the rows returned by a table or query. For read-only listing pages, prefer the simplest forward-only/read-only behavior that meets the page's needs.

Recordset.Open syntax

Recordset.Open Source, Connection, cursortype, locktype, commandtype

The Source may be a table, SQL statement or command; the selected cursor and lock types determine which navigation and update features are available.


ASP Home






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer