Solved

Access a MS Access DB that have a password

Posted on 2006-07-12
5
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses

617 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