ASP Tutorials - Herong's Tutorial Examples - v5.10, by Dr. Herong Yang
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