OLEDB connection to Access Database (accdb)

后端 未结 4 2113
有刺的猬
有刺的猬 2020-12-06 01:36

I want to make a simple application for an exercise, so it could be nice to connect to a simple database like Access (.accdb)

My program looks like this:

<         


        
相关标签:
4条回答
  • 2020-12-06 02:17

    add using System.Data.OleDb library.

    now for the connection string

    OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Aishwar NIGAM\\Documents\\indianOil.accdb");
    
    0 讨论(0)
  • 2020-12-06 02:21

    For others that are interested in my solution, I figured out that Microsoft.ACE.OLEDB.14.0 is not supported for Access 2010. Instead I used Microsoft.ACE.OLEDB.12.0

    You can download their "2007 Office System Driver: Data Connectivity Components" from this site: 2007 Office System Driver: Data Connectivity Components

    0 讨论(0)
  • 2020-12-06 02:25

    Had a similar problem but just a plan old mdb in my case. Provider=Microsoft.Jet.OLEDB.4.0 does the trick for that, no need to download any extra runtimes.

    0 讨论(0)
  • 2020-12-06 02:35

    You need the Access 2007 Runtime.

    0 讨论(0)
提交回复
热议问题