【问题标题】:Using Access 2010 database in c#在 C# 中使用 Access 2010 数据库
【发布时间】:2011-10-17 12:20:45
【问题描述】:

我目前正在使用 c# 访问 access 2010 数据库,但它无法打开数据库,因为当我使用 .mdb 时它似乎没有正确的驱动程序,这有效,但现在因为我使用的是 . accdb 它似乎不想打开数据库。这是打开代码。我想知道您有什么可以帮助我的吗?

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`

【问题讨论】:

    标签: c# database ms-access


    【解决方案1】:

    你需要改变:

    Provider=Microsoft.Jet.OLEDB.4.0
    

    Provider=Microsoft.ACE.OLEDB.12.0
    

    另请参阅:http://www.connectionstrings.com/access-2007#84

    【讨论】:

      【解决方案2】:

      您需要 Office 2007 的驱动程序 - 2007 Office System Driver: Data Connectivity Components

      【讨论】:

        【解决方案3】:

        要在客户端上使用未安装 Access 的数据库,您还必须使用 Engine2010 Access Database

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

        问候。

        【讨论】:

          猜你喜欢
          • 2014-10-11
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2013-03-15
          • 1970-01-01
          • 1970-01-01
          • 2013-11-09
          • 1970-01-01
          相关资源
          最近更新 更多