MS Access :: Do you have sample connection strings for DSN Less Connection and DSN Based Connection?

MS-Access Database Connection ASP code:

DSN Less Connection:

Dim strConn
Set strConn = Server.CreateObject("ADODB.Connection")
strConn="DRIVER={Microsoft Access Driver (*.mdb)}; "
strConn=strConn & "DBQ=" & Server.mappath
("db/mydb.mdb")

-OR-

strConn=strConn & "DBQ=C:\domains\mydomain.com\db\mydb.db"

DSN Based Connection:

Dim strConn
Set strConn = Server.CreateObject("ADODB.Connection")
strConn.ConnectionString = "DSN=test"
strConn.Open

Response.Write "Access Connection Successful"



Was this answer helpful?

« Back

chat