Data binding to a password protected Access database

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hello all,
I have been searching on the net for a
solution for days and have tried many different ways to no avail..:(

Here is my project using VB 2008...

I have an MS Access database with a password, a Main form with a
BindingNavigator, a Bbindingsource, a DataViewGrid, and a Login form with
two textboxes..
I have connected all except the login form. The project works well when I
store the password in the connection string through the
database wizard. The wizard adds a DataSet, and a TableAdapter.

I Do Not want to store the password in the connection string. I want to use
the Login form to enter the User ID and User Password for the database.

How do I use the info entered by the user in Login form to connect to the
database where UsernameTextBox.text = dbUserID and PasswordTextBox.text =
dbPassword

1) Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
2) 'TODO: This line of code loads data into the 'DataSet.tblMylist' table.
You can move, or remove it, as needed.

3) Me.TblMylistTableAdapter.Fill(Me.DataSet.tblMylist)

4) End Sub

The program stops at line 3 with the error 'Not a valid Password'

Before you ask, yes it is a valid password because I have accessed the
database outside of VB using the same password.

I would like to be able to pass the dbUserID and password variables to the
connection string so that when the program gets to line 3 it opens

up the Main form and populates the DataViewGrid with the data in the
database table.

I would also like to be able to change the database password at run time by
clicking a Change Password button ...



One would think that Microsoft would automatically include a login form with
the proper parameters in the database wizard when a

person selects not to store sensitive data in the connection string... If
they did well I haven't found it

I hope that I presented my problem clearly enough for someone out there to
be able to help. If not please ask and I will try again.



.


Quantcast