BlueJay924 Posted July 18, 2003 Posted July 18, 2003 i need some help trying to connect to an access database. For a while now I've been using vb.net, and i've had no problem connecting to a database. The reason i've had no problem is because i haven't been using a password. it's when i protect the database with a password is when i can't connect. What i've been doing so far is opening the database with open-exclusive, and from there i set the password. I assumed that this code would work: cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= C:\databaseToOpen.mdb;password = thePassword") cn.Open() but so far no luck. Is it even possible with only a password? If so, what am i doing wrong. Evenutally i'd like to be able to add new users/passwords, but still having problems. Any kind of tutorial for this would be really helpful. Quote
Leaders dynamic_sysop Posted July 18, 2003 Leaders Posted July 18, 2003 try looking at this thread... ( directly below yours ) i put a sample code there . open an access database ( with / without password ) Quote
BlueJay924 Posted July 18, 2003 Author Posted July 18, 2003 I tried your sample code, but all i got was this message: "Cannot start your application. The workgroup information file is missing or opened exclusively by another user" Even when i set the id as administrator and password as null, i still get the same message. This is a portion of what i have: strPath = "c:/nameofdatabase.mdb" strPassword = "thePassword" Dim Connection As String "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=" & strPath & ";Jet OLEDB:Database Password=" & strPass & ";User ID=username;Persist Security Info=True" Try Dim cn As New OleDbConnection(Connection) cn.Open() Catch ex As Exception MessageBox.Show(ex.Message) End Try What am i doing wrong? Quote
BlueJay924 Posted July 18, 2003 Author Posted July 18, 2003 Thanks for the help. I did solve my problem. I had to add "Jet OLEDB:System database=C:\Secured.mdw;" into the connection string. Everything works fine. thanks again. I do have another question though. What is the difference between using Password and Jet OLEDB:Database Password? I can use Password but not Databse Password. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.