Access Database Connections
Without DSN
<%
Set Cnn = Server.CreateObject("ADODB.Connection")
Cnn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=c:mydatabase.mdb"
%>
OLE DB
<%
Set Cnn = Server.CreateObject("ADODB.Connection")
Cnn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=c:mydatabase.mdb"
%>
Using a physical path as a reference
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtest=dsntest & "DBQ=c:mydatabase.mdb"
Conn.Open DSNtest
%>
Using Server.MapPath
NOTE: Server.MapPath is the path from the Web server root. By default, this is C:InetpubWwwroot.
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSNtest="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtest=dsntest & "DBQ=" & Server.MapPath("/databases/mydatabase.mdb")
Conn.Open DSNtest
%>