ADO OLE DB – Microsoft Jet Provider Connection Example

 

OLE DB Provider for Microsoft Jet Connection String Method

This examples show the method for the OLE DB Microsoft Access Jet.

Dim conn as ADODB.Connection
Dim rst as ADODB.Recordset
Dim sql as string
‘—————

Standard Access Security: Conn.Open “Provider=Microsoft.Jet.OLEDB.4.0;” & _
“Data Source=my_pathmy_database.mdb;” & _
“User ID=userid;” & _
“Password=password;”

Access workgroup security – system database: Conn.Open “Provider=Microsoft.Jet.OLEDB.4.0;” & _
“Data Source=my_pathmy_database.mdb;” & _
“Jet OLEDB:System Database=system.mdw;” & _
userid“,”password

userid = the userid you have identified in the database, or the default ‘Admin’ username.

password = the password you have setup in the database or “” for no password.

‘————–  here we use the connection

sql = “select sales_rep, dollars from sales_by_rep_chart”

Set rst = Server.CreateObject(“ADODB.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