当mdb文件有密码时从.net访问mdb文件内容
我正在用 C# 创建一个窗口应用程序,并正在考虑在 MS-Access 的 mdb 文件上设置一个密码,这样除了我的窗口应用程序或知道该文件密码的人之外,没有人可以打开该文件。
我设法对该文件进行密码保护,但不幸的是我无法通过我的应用程序访问该文件。实际上我不知道在哪里设置用户名和密码来打开该文件。在连接字符串中输入用户名和密码不起作用。
编辑 抱歉有点混乱,
我希望该文件受到密码保护,而不是数据库连接。 在任何情况下都不应打开该文件。为此,我设法使用 ms access 本身在文件上设置密码,但我无法通过我的应用程序打开该文件。
Edit2: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Projects\GargTubes\dbGargTubes.mdb; User Id=""; Password="abc";"
我正在使用MS-Access 03
编辑 3:
Provider=Microsoft.Jet.OLEDB.4.0;数据 来源=E:\Projects\GargTubes\dbGargTubes.mdb; 数据库密码=abc;"
Provider=Microsoft.Jet.OLEDB.4.0;数据 来源=E:\Projects\GargTubes\dbGargTubes.mdb;JET OLEDB:数据库密码=abc;
错误:找不到可安装的 ISAM
I am creating a window application in C# and was thinking of setting up a password on mdb file of MS-Access so that no one can open that file other than my window application or who so ever knows password of that file.
I managed to make that file password protected but unfortunately I was not able to access that file through my application. Actually i not getting where to set the user name and password to open that file. Entering username and password in connection string is not working.
EDIT
Sorry for bit confusion
I want that file to be password protected rather than database connection.
That file should not be opened in any case. For that i managed to set password on file using ms access itself but i m not able to open that file through my application.
Edit2: "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Projects\GargTubes\dbGargTubes.mdb; User Id=""; Password="abc";"
I am using MS-Access 03
Edit 3:
Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Projects\GargTubes\dbGargTubes.mdb;
Database Password=abc;"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=E:\Projects\GargTubes\dbGargTubes.mdb;JET
OLEDB: Database Password=abc;Error: Could not find installable ISAM
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试在连接字符串中设置数据库密码:
Try setting the database password in your connection string:
您可以查看连接字符串示例:Access 连接字符串
You can take a look into that connection strings samples: Connection strings for Access
由于您正在谈论传递用户名和密码,因此我假设您已通过设置用户权限而不是使用“数据库密码”选项来保护数据库。在这种情况下,用户和组存储在
system.mdw
中。请务必在连接字符串中包含system.mdw
的路径 (Jet OLEDB:System Database=path\to\system.mdw
,请参阅 Access 连接字符串 示例)。或者,您可以使用“数据库密码”功能。然后,其他答案中描述的 Jet OLEDB:Database Password 选项应该可以工作。拼写出来:
Since you are talking about passing user name and password, I assume that you have protected your database by setting user rights rather than by using the "database password" option. In that case, users and groups are stored in
system.mdw
. Be sure to include the path tosystem.mdw
in your connection string (Jet OLEDB:System Database=path\to\system.mdw
, see Connection strings for Access for samples).Alternatively, you use the "database password" feature. Then, the
Jet OLEDB:Database Password
option described in the other answers should work. To spell it out: