StumbleUpon
Share on Facebook

Saturday, February 7, 2009

ADO Connection String for Access 2007 Database

ADO Connection String for Access 2007 Database

Here is the ADO connection string example for Access 2007 database.

Set Cn = New ADODB.Connection

Cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\comp\Documents\SampleDB.accdb;Persist Security Info=False"

If the database needs password then use the following string:

Cn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\comp\Documents\SampleDB.accdb; Jet OLEDB:Database Password=MyDbPassword;"

The project that uses the code should have reference to ActiveX data objects library

1 comment:

Carl Connett said...

Just what I needed! Thanks!

Related Posts Plugin for WordPress, Blogger...