Click here to Skip to main content
13,089,943 members (42,166 online)
Rate this:
Please Sign up or sign in to vote.
See more:

Can someone help me to open a Access database (protected with a password) in
my application in Visual Basic 2008. I use Oledb connection to link my Application
to the database. When my Access database is not protected with password
my connection goes well, but I don't know how to set my password of my database
in my application.
I have "googled", but I can't find something that works for me. Pleas Help! :((

That's the code that I have at moment:

Dim connectiestring As String
connectiestring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & My.Settings.LocatieDB & "'"
Dim connectie As New OleDb.OleDbConnection(connectiestring)
Dim SQLcommand As New OleDb.OleDbCommand
SQLcommand.Connection = connectie
Posted 1-Jun-10 12:55pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

This should answer your question
William Winner 2-Jun-10 11:56am
Yep...if you used Security-->Set Database Password, you have to include "Jet OLEDB:Database Password=password" in the connection string.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Have you tried adding ";Password=password;" to the end of your "connectiestring"?

Is it secured with a database level password or a Workgroup? If it is a workgroup you would probably have to provide the user as well so also add "User Id=whatevertheuseridis" to the connection string.
William Winner 2-Jun-10 11:54am
Reason for my vote of 2
password doesn't work with OLE for a database-wide password.

You have to use "Jet OLEDB:Database Password"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 2 Jun 2010
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100