Simplest way to get ADO.NET conection string for mdb database
I'm learning ADO.NET and have been stuck for DAYS trying to get a connection string for a plain, vanilla .mdb database. I've been trying potential connection strings and permutations from this site but NOTHING works; the database connection is never opened.
The ODBC Data Source Administrator lists the driver as: "Driver do Microsoft Access (*.mdb)". Another application can successfully open this database, so I know my system is capable of it.
Can anyone suggest a SIMPLE connection string that will work?
1 answer
The Solution:
Connection String:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=path to database.mdb; or Provider=Microsoft.ACE.OLEDB.12.0;Data Source=path to database.mdb;
Example:
string connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\ps\Data\Database File\xtreme.mdb;";
OleDbConnection myConn = new OleDbConnection(connString);
myConn.Open();