Saturday, July 23, 2011

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

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Deep's | Bloggerized by Deep - Deep's Templates | ElearSQL-Server