开发者

Access mdb file content from .net when mdb file has password

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 So开发者_如何学Gource=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


Try setting the database password in your connection string:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:Database Password=MyDbPassword;


You can take a look into that connection strings samples: Connection strings for Access


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 to system.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:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Projects\GargTubes\dbGargTubes.mdb;Jet OLEDB:Database Password=abc
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜