C# 通过OLEDB连接ACCDB格式的MS-ACCESS数据库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2373355/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 01:51:57  来源:igfitidea点击:

Connecting to ACCDB format MS-ACCESS database through OLEDB

c#.netvb.netms-accessoledb

提问by Marcelo

I've recently made another questionabout connecting to MS-ACCESS database with .NET in C# or VB.NET. It worked just as intended with MDB, but with accdb it caused an exception in

我最近提出了另一个关于在 C# 或 VB.NET 中使用 .NET 连接到 MS-ACCESS 数据库的问题。它在 MDB 中按预期工作,但在 accdb 中导致异常

conn.Open();

which follows:

如下:

alt text http://dl.dropbox.com/u/3045472/accdb_fail.png

替代文字 http://dl.dropbox.com/u/3045472/accdb_fail.png

Is there another way to do this? My original intention (like stated in the original question) is gathering some (actually, a lot of) fields.

有没有另一种方法可以做到这一点?我的初衷(如原始问题中所述)是收集一些(实际上是很多)领域。

采纳答案by Andrey

Use ACE 4 driver, download it herethen use following connection string:

使用 ACE 4 驱动程序,在此处下载,然后使用以下连接字符串:

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\marcelo.accdb;Jet OLEDB:Database Password=MyDbPassword;"

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\marcelo.accdb;Jet OLEDB:Database Password=MyDbPassword;"