Brinkster Knowledge Base

KB Home   /  Support  /  Database  /  MS Access  /   How do I connect to a MS Access database with ASP
How do I connect to a MS Access database with ASP Articles

** Important information regarding the following code samples. **

Be sure to make note of the following when using these coding examples:
1. Replace username with your Brinkster hosting account username.
2. Replace password with the password for the account used above.
3. In a server.mappath '.\' takes you to the webroot and '..\' takes you up one level in your file structure 
        '.\..\database' puts you into the database directory at the same level as webroot.
4. Remember to edit the database name to match your actual .mdb name.

Dim oConn, sConnection

 

Set oConn = Server.CreateObject("ADODB.Connection")

sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

              "Data Source=" & server.mappath(".\..\database\demo.mdb") &";" & _

              "Persist Security Info=False"

oConn.Open(sConnection)

 

oConn.Close

Set oConn = nothing