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

Recommended Answers

All 10 Replies

Using what db?
post your connection code.

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")

It should be like this :

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccess2007file.accdb;Jet OLEDB:Database Password=MyDbPassword;

For more information see this site

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.

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

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.

do u mean, yr access database has password...
u should try my code...

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
            End If
            MDIFrm.Show()
            Me.Hide()
        Else
            count += 1
            'maximamm time the user can tray to enter password and user name 
            If count = 3 Then
                UsersTableAdapter.UpdateBlocked(TxtUsername.Text)
                MsgBox(" Wrong Password...You are blocked")
                Me.Close()
            End If
            MsgBox("Wrong Password...try again")
        End If





    End Sub

thank you everyone..it's solved..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.