Solved

Access a MS Access DB that have a password

Posted on 2006-07-12
5
178 Views
Last Modified: 2010-04-16
I want to access a database that have a password and the code give me an exception : the file is already open by another user or it's open exclusively. The problem is that the file is not in exclusive mode or open by another user. If I remove the password and set the opening mode to normal, i've got no errors, but if i leave the password, i got the error. Even if I open it witn normal mode.

The code:

String accessConnStr = @"Provider=Microsoft.Jet.OLEDB.4.0;
                                       User Id=admin;Password=Pass;DataSource=C:\DATA.mdb";

try{
        OleDbConnection myConnection = new OleDbConnection(accessConnStr );
        myConnection.open();   // the exception appears when it attempt to connect.
}
...


Can someone help me plz???
0
Comment
Question by:ventrol
5 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 17093039
Try adding this to the connection string:

Jet OLEDB:Database Password=password;

Bob
0
 
LVL 4

Expert Comment

by:DarkXiphoid
ID: 17097569
Check if the database isn't still used by another connection in your application. Always close any connection you opened.

If it still gives the error, you can try to make a new, fresh database and try to connect to that to make sure the problem is in the database and not in your page.

Tell me what happens after you've done this!

Regards,

Robert
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question