Access database

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
2 posts Page 1 of 1
Contributors
User avatar
Mark
VIP - Donator
VIP - Donator
Posts: 372
Joined: Mon Aug 17, 2009 10:35 pm

Access database
Mark
Hello,

I use this code below it logs me in fine all working i have a filed called roll say i have the roll as Admin and i want to display a menu strip how do i go about this but if there normal account type then the menu strip wont show this is the code i have at the moment?
Code: Select all
 Private Sub login()
        Try
            sqL = "SELECT * FROM users WHERE Username = '" & txtUsername.Text & "' AND Password = '" & txtPassword.Text & "'"
            ConnDB()
            cmd = New OleDbCommand(sqL, conn)
            dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
            If dr.Read = True Then
                txtUsername.Text = ""
                txtPassword.Text = ""
                Me.Close()
            Else
                MsgBox("Incorrect username or Password!", MsgBoxStyle.Critical, "Login")
                txtPassword.Focus()
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            cmd.Dispose()
            conn.Close()
        End Try
    End Sub
Thanks

Mark
http://www.mbappz.com
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: Access database
CodenStuff
Sending this from mobile so can't go into depths at the moment but I figure it would be quite simple.

Here are the steps:
- user logs-in
- on successful log-in, run query and get users roll
- store users roll in global variable, boolean perhaps
- now just run your code to check if variable is true or false
- if true, user is admin, show menustrip..etc
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
2 posts Page 1 of 1
Return to “Coding Help & Support”