vb.net 无法识别的数据库格式'C:\.....\Employees.accdb for Microsoft Access 数据库文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23160313/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unrecognized database format'C:\.....\Employees.accdb for Microsoft Access Database File?
提问by 0000
I am trying to access a file stored in a Microsoft access database.(I am working in Visual Studio 2012) I chose the Database source type, and the Dataset database model, when it asks me "which data connection should your application use to connect to the database?", I clicked New Connection, then i chose Microsoft Access Database File (OLE DB). Under Database file name, i clicked browse and selected the appropriate file(Employees.accdb). When i press Test Connection or Ok i get this error: Unrecognized database format'C:.....\Employees.accdb. Any ideas as to what i am doing wrong?
我正在尝试访问存储在 Microsoft access 数据库中的文件。(我在 Visual Studio 2012 中工作)当它询问我“您的应用程序应该使用哪个数据连接来连接时,我选择了数据库源类型和数据集数据库模型到数据库?”,我单击了“新建连接”,然后选择了 Microsoft Access 数据库文件 (OLE DB)。在数据库文件名下,我单击浏览并选择了适当的文件(Employees.accdb)。当我按测试连接或确定时,我收到此错误: 无法识别的数据库格式'C:.....\Employees.accdb。关于我做错了什么的任何想法?
回答by 0000
Your computer is missing Microsoft.ACE.OLEDB.12.0
你的电脑不见了 Microsoft.ACE.OLEDB.12.0
You can get it from here: http://www.microsoft.com/en-us/download/details.aspx?id=13255
你可以从这里得到它:http: //www.microsoft.com/en-us/download/details.aspx?id=13255
回答by absenthecon
I know this is a bit old but if anyone else has the same problem, this worked for me.
我知道这有点旧,但如果其他人有同样的问题,这对我有用。
According to your description, I create a sample VB project and try connect to the Access 2016 database and I get the same result with you. Then I try to connect old version of Access database and it is successful.
根据您的描述,我创建了一个示例VB项目并尝试连接到Access 2016数据库,结果与您相同。然后我尝试连接旧版本的 Access 数据库,它成功了。
I find the Provider that used to connect the old version is Microsoft.Jet.OLEDB.4.0. But for Access 2016 database, we should use Microsoft.ACE.OLEDB.12.0. So we need to install Microsoft Access Database Engine 2010 Redistributableand 2007 Office System Driver: Data Connectivity Components, which will help us install and register Microsoft.ACE.OLEDB.12.0 to our local machine.
我发现用来连接旧版本的Provider是Microsoft.Jet.OLEDB.4.0。但是对于 Access 2016 数据库,我们应该使用 Microsoft.ACE.OLEDB.12.0。所以我们需要安装Microsoft Access Database Engine 2010 Redistributable和2007 Office System Driver: Data Connectivity Components,这将帮助我们安装和注册 Microsoft.ACE.OLEDB.12.0 到我们的本地机器。
Then please connect the Access 2016 database with following steps.
然后请按照以下步骤连接 Access 2016 数据库。
Add New Data Source --> database --> Dataset --> New Connection --> Microsoft Access Database File --> select the accdb file -> Click Advanced button to change the Provider. Then click the OK button back to the Add connection windows and Test connection, it will succeed.
添加新数据源--> 数据库--> 数据集--> 新连接--> Microsoft Access 数据库文件--> 选择accdb 文件-> 单击高级按钮更改提供程序。然后点击确定按钮回到添加连接窗口和测试连接,就会成功。