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
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.mdwin 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 Passwordoption described in the other answers should work. To spell it out: