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

StumbleUpon
Share on Facebook

Monday, February 2, 2009

ADO Connection String for Excel

Excel Connection Strings

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Orginal.xls;Extended Properties=Excel 8.0;Persist Security Info=False"
StumbleUpon
Share on Facebook

ADO Connection String for Text Files

ADO Connection String for Comma Separate File (CSV)

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\temp\;Extended Properties=""text;HDR=Yes;FMT=Delimited(,)"";Persist Security Info=False"


Related Posts Plugin for WordPress, Blogger...