Connecting ASP to an Access database

Don't use DSNs to connect to a database. Setting up DSNs requires that you have permissions that may not available to you in the labs. Instead try the technique illustrated in the following segment of ASP code. The code is based on the assumption that the ASP page and the Access database are in the same folder:

<%
'
' o DatabaseNameStr contains the name of the Access database file
' o DatabaseLocationString "discovers" the path on the server to 
'   the current directory
' o ConnectionStr uses the two strings above to tell the web server 
'   where and how to open the Access file
'
dim DatabaseNameStr, DatabaseLocationStr, ConnectionStr, Conn, sqlstr, rs

DatabaseNameStr = "tasks.mdb"
DatabaseLocationStr = Left(Request.ServerVariables("PATH_TRANSLATED"), _
                           InstrRev(Request.ServerVariables("PATH_TRANSLATED"), _
                                    "\") _
                           )
ConnectionStr = "DBQ=" & _
                DatabaseLocationStr & _
                DatabaseNameStr & _
                ";DefaultDir=" & _
                DatabaseLocationStr & _
                ";Driver={Microsoft Access Driver (*.mdb)};"
'
' In other words: 
' ConnectionStr = "DBQ=pathInfo\tasks.mdb;
'                  DefaultDir=pathInfo\;
'                  Driver={Microsoft Access Driver (*.mdb)};" 
'

set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open(ConnectionStr)

sqlstr = "SELECT * FROM ToDoList ORDER BY ID"
set rs = Conn.Execute(sqlstr)
%>