<% noads=1 %> <%dim crumb crumb="DSN-Less Connection" Crumb2="DSN-Less Connection String" crumb1="DSN Less Database Connection Example" %> DSN-Less Database Connections
Home  Fees/Services  Access Examples  Programming Tutorials  Access Download  Articles  Search  Contact  Privacy  Links
  <%if len(crumb2)>2 then response.write crumb2 %>
 <% response.write crumb1 %>
 Home > MS Access Tutorials > Connection Strings<% response.write " > " & crumb %>

<% dim Gnum,Ynum Gnum="0957644070" Ynum="7867" dim Page_Type Page_Type="Prog" %>






Connect String to Access DSN

Connect String to OLEDB Provider for Jet

Database Connect String to Remote Database

ADO File-DSN Database Connection String

Access DSN-Less Connection String

SQL/Server ODBC Database Connection Method Example

OLE DB UDL Database Connection String Example

Connection Open Method String Example

Microsoft Office:
  MS Access 2003
  Access 2007
  Access 2010
  Access 2013


DSN-less Connection String Code

DSN less Connection Method Example

DSN less database connection string example is shown in the first example below and can be used with Microsoft Access databases and others.  DSN less method is considered to be faster than the DSN method.

Dim conn as DB.Connection
Dim rst as DB.Recordset
Dim sql as string
'---------------

Without workgroup security, .mdw system file:
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & _
                   "DBQ=path_to_database;" & _
                   "PWD=password;"

With workgroup security:
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & _
                   "DBQ=path_to_database;" & _
                   "SystemDB=path_to_system_database;" & _
                   "PWD=password;"

Where:
path_to_database = The database path, such as F:\mydatabases\orders.mdb

username = the username you have identified in the database, or the default 'Admin' username.

password = the password you have setup in the database or nothing  "Pwd=;" for no password.

path_to_system_database the path to where the system MDW file exits, such as X:\mydatabasestuff\system.mdw

'--------------  here we use the dsn-less connection

sql = "select sales_rep, dollars from sales_by_rep_chart"

Set rst = Server.CreateObject(" DB.Recordset")
rst.Open sql, conn, 3, 3
Set Session("mysession") = rst
rst.movefirst
response.write rst!sales_rep

'--------------

Where mysession is any name for the session.

When done with the recordset don't forget to close it:

Conn.close
set conn=nothing

You may also disconnect from the DSN-less database connections session by issuing:

session.abandom

















Contact Information

<% Response.write "Copyright 2000-" & year(now) & " Blue Claw Database Design" %>