C# – Access Database, Connection string jiggery pokerery

cconnection-stringms-access

I am trying, from my c# codefile to access an Access Database. If I use the:

SqlConnection connection = new SqlConnection(connectionString)

with the connection string being:

connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\testing_dev\sm_development\App_Data\SMWeb.mdb"

I get an error when I try and create a dataset that the word 'provider' is not supported! What am I doing wrong?

Best Answer

Try this.

OleDbConnection connection = new OleDbConnection();
string connectionString= @"Data Source=F:\testing_dev\sm_development\App_Data\SMWeb.mdb";

OleDbConnection is in the System.Data.OleDb namespace.

Related Topic