i had set a password for my database to protect my data but the problem is that my database doesn't function with my codes in vb...how do i solved this? please help

database...con = New OleDbConnection("Provider= Microsoft.ACE.oledb.12.0; Data Source=C:\Users\edenzam\Desktop\CBFMNHS Enrollment System\CBFMNHS Enrollment System\bin\Debug\Enrollment System.accdb")

this is my new connection string
Dim con As New OleDbConnection("Provider=Microsoft.ace.oledb.12.0;data source=C:\Users\edenzam\Desktop\CBFMNHS Enrollment System\CBFMNHS Enrollment System\bin\Debug\Enrollment System.accdb;Jet OLEDB:Database Password=MyDbPassword;")
but their is an error saying that it is invalid password

but their is an error saying that it is invalid password

It means your password in connection is wrong.
change this MyDbPassword with your own password.

Edited 4 Years Ago by Jx_Man

try this if u using access database...

Dim conAccess As OleDb.OleDbConnection
conAccess = New OleDb.OleDbConnection
conAccess.ConnectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & Application.StartupPath & "\mydatabase.mdb;Jet OLEDB:Databse Password=123456;"

// put the password at the end of the connection...

it should work

Edited 4 Years Ago by arezz09

Change the password inside the connection string (as Jx said already). And where is username? Usually there are both, username and password in the connection string.

You should first of all to you so
1 - Design Querrey for searches that match the name of the user with a password within the database.
2 - In the following code, which you used in the graduation project is working well:

Public Class LoginFrm
    'decler count for passward 
    Dim count As Integer = 0

    Private Sub BtnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnLogin.Click
        'cheked the user name when availabel or not 
        "your"TableAdapter.FillBy"Your query"('Your'DatabaseDataSet.'TableName', TxtUsername.Text)
        If 'Your'DatabaseDataSet.Users.Rows.Count = 0 Then
            MsgBox("Invalid Username")
        End If
        "your"TableAdapter.FillBy'query'("your"DatabaseDataSet.'TableName', TxtUsername.Text, TxtPassword.Text)
        If "your"DatabaseDataSet.Users.Rows.Count = 1 Then

            'blouk the users 
            If VisionDatabaseDataSet.'TableName'.Item(0).Item(3) Then
                MsgBox("you have been blocked..Contact the administrator")
            End If
            count += 1
            'maximamm time the user can tray to enter password and user name 
            If count = 3 Then
                MsgBox(" Wrong Password...You are blocked")
            End If
            MsgBox("Wrong Password...try again")
        End If

    End Sub

Edited 4 Years Ago by pyTony: fencing ~~~ vb code tags added

This question has already been answered. Start a new discussion instead.