Connection to MS Access with ASP

How to create an ADO connection to an Access database in ASP with Provider=Microsoft.ACE.OLEDB.12.0.

When you need to open access to an Access database from your ASP website, you must use an ADO database connection.

It can be set up as follows:

<%
dim conn

function OpenConn( DBPath )

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath 

end function

OpenConn("d:\web\localuser\[domain]\database\database.mdb")
%>

If you use JavaScript as the default language in ASP, the following connection string can be used:

<%
Conn = Server.CreateObject("ADODB.Connection");
Conn.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath("database.mdb"))
%>

Article from the support category: ASP & ASP.NET