4

I am currently accessing a access 2010 database in c# and its unable to open the database as it doesn't seem to have the correct driver when I was using a .mdb this worked, but now since I'm using a .accdb it doesn't seem to want to open the database. Here's the opening code. I was wondering if there was anything you could help me with?

public void openDatabase(string dbname)
    {
        //dataBaseName = dbname;
        dataBaseName = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=houses.accdb"; //Defines the location of the database and its type.

        connection = new OleDbConnection(dataBaseName); //Creates a new OleDbConnection using the data from dataBase.

        connection.Open(); //Opens the TCP/IP connection.
    }`enter code here`

3 Answers 3

4

You need to change:

Provider=Microsoft.Jet.OLEDB.4.0

To

Provider=Microsoft.ACE.OLEDB.12.0

See also: http://www.connectionstrings.com/access-2007#84

Sign up to request clarification or add additional context in comments.

Comments

0

You need the driver for Office 2007 - 2007 Office System Driver: Data Connectivity Components

Comments

0

to use the datbase without Access installed on a client you must also Engine2010 Access Database

http://www.microsoft.com/download/en/details.aspx?id=13255

Regards.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.