Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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?

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...