Solved

Access a MS Access DB that have a password

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now