获取mdb数据库的ADO.NET连接字符串的最简单方法 [英] Simplest way to get ADO.NET connection string for mdb database

查看:78
本文介绍了获取mdb数据库的ADO.NET连接字符串的最简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习ADO.NET,并且一直困扰着DAYS尝试为普通的vanilla .mdb数据库获取连接字符串。我一直在尝试潜在的连接字符串和排列,但没有工作;永远不会打开数据库连接。



ODBC数据源管理员将驱动程序列为:驱动程序执行Microsoft Access(* .mdb)。另一个应用程序可以成功打开这个数据库,所以我知道我的系统能够实现它。



任何人都可以建议一个SIMPLE连接字符串可以工作吗?



我尝试过:



来自connectionstrings.com的字符串。尝试讨论连接字符串的文章。

I'm learning ADO.NET and have been stuck for DAYS trying to get a connection string for a plain, vanilla .mdb database. I've been trying potential connection strings and permutations but NOTHING works; the database connection is never opened.

The ODBC Data Source Administrator lists the driver as: "Driver do Microsoft Access (*.mdb)". Another application can successfully open this database, so I know my system is capable of it.

Can anyone suggest a SIMPLE connection string that will work?

What I have tried:

Tried strings from connectionstrings.com. Tried articles that discussed connection strings.

推荐答案

这应该是旧版式(Access 2003及更早版本)数据库。它通常使用JET引擎,而不是ACE,虽然ACE仍然可以打开它。

That should be an older style (Access 2003 and older) database. It normally uses the JET engine, not ACE, though ACE may still be able to open it though.
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=path to database.mdb;



or

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=path to database.mdb;

当然,你需要安装Access运行时或安装相应的Office版本来打开它,即使是你自己的代码,也要在每台要使用它的机器上打开它。数据库。



对于JET,它是Access 2003及以下版本。对于ACE,它是2003年以上Access的任何版本。



编辑:

哦,.MDB文件必须在文件夹中用户具有读写权限。这不包括程序文件下的任何内容。

Of course, you'll need the Access runtime or the appropriate version Office installed to open it, even from your own code, on every machine that's going to use the database.

For JET, it's Access 2003 and below. For ACE, it's any version of Access above 2003.


Oh, and the .MDB file MUST be in a folder the user has read and write permissions to. That does NOT include anything under Program Files.


这篇关于获取mdb数据库的ADO.NET连接字符串的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆