0

Is there ant way to use Access 2016 database instead 2003 I was trying to access MS Access 2016 in VS 2017 but it was giving unrecognized database format. I want to know why it's happening as they both are among latest versions but it is working if we use access 2003 format instead 2016

I have used this question to solve the same problem

Unrecognized database format accdb in visual studio

Code to access database(Main Form):

 private void ManageEmployeesForm_Load(object sender, EventArgs e)
    {
        LoadDataintoGridView();
    }

    private void LoadDataintoGridView()
    {
        EmployeesListdataGridView.DataSource = GetEmployeesList();
    }

    private DataTable GetEmployeesList()
    {
        DataTable dtEmployees = new DataTable();
        string connString = 
ConfigurationManager.ConnectionStrings["dbx"].ConnectionString;

        using (OleDbConnection con = new OleDbConnection(connString))
        {
            using (OleDbCommand cmd = new OleDbCommand("SELECT * FROM 
 Mytabe",con))
            {
                con.Open();

                OleDbDataReader reader = cmd.ExecuteReader();

                dtEmployees.Load(reader);
            }
        }
        return dtEmployees;
    }

Connection string:(App.config)

<connectionStrings>
<add name="dbx" connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data 
Source = D:\Access Database\KaleemDatabase.mdb" 
providerName="System.Data.OleDb"/>
</connectionStrings>   

I am willing to use latest version but it is not working for latest version

Kaleem
  • 129
  • 1
  • 14
  • Possible duplicate of [OLEDB connection to Access Database (accdb)](https://stackoverflow.com/questions/8302349/oledb-connection-to-access-database-accdb) – Gustav Apr 14 '19 at 07:13
  • Is there 2016 written any where? And Take a review of both codes. PLZ – Kaleem Apr 14 '19 at 09:16
  • You should be able to extrapolate the version numbers. Anyway, here is the [Microsoft Access Database Engine 2016 Redistributable](https://www.microsoft.com/en-us/download/details.aspx?id=54920) for download. – Gustav Apr 14 '19 at 09:51

0 Answers0