Solved

Access a MS Access DB that have a password

Posted on 2006-07-12
5
179 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I do Unit Testing with Session ? 1 41
How to force output to ascii 2 62
c#, case, if 4 37
aspx ascx, c# 7 43
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 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