Hy guys,
.
Please assist in advicing whch toolbox conncetion controls to add in my form. I want to connect to access 2007 using vb.net 2005 and im struggling. I have two textboxes(username and password) and two buttons(submit and cancel). When I click on the submit button it supposed to allow the user to logon to the system, but it dsnt…my connection string is
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Video Rental System\DvDSystem1.accdb
Which is fine(I think).
.I can’t get the congurations right for thelogin form in desing view (properties window)
.I need urgent assistance pls help

Post up your code and we'll have a look. Its hard to fix someone's problem when you can't see what could be causing it...

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click

    Dim MainrMenur As New frmMainrMenur

    'Logic for login...
    Dim conn As New OleDb.OleDbConnection
    Dim cmd As OleDb.OleDbCommand
    Dim selectQuery As String
    Dim dr As OleDb.OleDbDataReader
    Dim userProfile As String

    Try
        'conn = New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Video Store\DvDSystem1.accdb;")
        conn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Video Store\Video Store\DvDSystem.mdb")
        conn.Open()
        selectQuery = "SELECT * FROM USERR WHERE userID = '" & txtUserName.Text & "' AND userPassword = '" & txtUserPassword.Text & "'"
        cmd = New OleDb.OleDbCommand(selectQuery, conn)
        dr = cmd.ExecuteReader()
        conn.Open()
        'if successfull then log in
        If dr.Read() Then
            'Get user profile
            userProfile = dr.GetString(3)
            keptProfile = userProfile
            MainrMenur.Show()
            If keptProfile = "admin" Then
                MainrMenur.Show()
                MainrMenur.SetKeptProfile(keptProfile)
                MainrMenur.btnManageUsers.Enabled = True
                MainrMenur.btnDVD.Enabled = True
                'MainrMenur.btnReports.Enabled = True
            Else
                MainrMenur.Show()
                MainrMenur.btnManageUsers.Enabled = False
                MainrMenur.btnDVD.Enabled = False
                'MainrMenur.btnReports.Enabled = False

            End If

        ElseIf txtUserName.Text <> "" Then
            If txtUserPassword.Text <> "" Then
                MessageBox.Show("Wrong login, please try again ...", "Login Denied", MessageBoxButtons.OK)
            Else
                MessageBox.Show("Please enter password", "Login Error", MessageBoxButtons.OK)
                txtUserPassword.Focus()
            End If
        Else
            MessageBox.Show("Please enter user id", "Login Error", MessageBoxButtons.OK)
            txtUserName.Focus()
        End If
        'Clear password field after login
        txtUserPassword.Clear()
        dr.Close()
        'Catch ex As OleDb.OleDbException
    Catch ex As Exception
        MessageBox.Show("Please exit system and login again.", "Login Error", MessageBoxButtons.OK)
        'conn.Close()
    End Try
    'conn.Close()
    Me.Close()

got the answer...what i had to do was put [] brackets in fields with spaces.

thanks guys for all your efforts..really appreciate it

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.