Connection to MS Access with ASP

When you need to access an Access database, you need 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.Jet.OLEDB.4.0;Data Source=" & DBPath 

end function

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

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

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

Article from the support category: ASP & ASP.NET