In my VB.net application i have a login form with two textboxes, One for the username and one for the password.
I also have a form setting where people are given the right whether to use the application or not and on top of that when sumeone is given the right to use the application he needs to be given a privelege level(IsManager,IsAdmin,Employee)
here's the form use to add and give the user the right privelege to the Application:
On my Database i have a table called Users, its a DB where all the users infos of the application are store
The users table's columns are EmployeeId,Name,Title,IsManager,IsAdmin,Employee,Username,Password
Ismanager,Isadmin,employee are boolean columns meaning their values can only be 0 or 1 and the result is displayed as a checkbox.
When the user logs into the application using his username and password i want it to check whether is a manager,admin or employee.
If all 3 conditions are true then the user can have access to every function of the application such as Add,Edit,Delete,Print etc.....
I haven't done alot on this but i would like to achieve this by using select case statement
here's what i started
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Dim con As New SqlClient.SqlConnection(My.Settings.NewEvapcoDBConnectionString.ToString) Dim cmd As New SqlClient.SqlCommand("Select Username From Users Where [Users].username Like '%" + UsernameTextBox.Text + "%' and [Users].password Like '%" + PasswordTextBox.Text + "'", con) Dim a As Integer Dim b As Integer Dim c As Integer Try con.Open() Dim ObjReader As SqlClient.SqlDataReader ObjReader = cmd.ExecuteReader If ObjReader.HasRows = False Then UsernameTextBox.Text = ObjReader("Username") 'MsgBox("User does not exists! Please add new user") ElseIf UsernameTextBox.Text = "" Or PasswordTextBox.Text = "" Then MsgBox("Please make sure both username and password are filled in", MsgBoxStyle.Critical, "Error") Else Select Case a Case b I AM STUCK HERE CAN SUMEONE HELP ME End Select EvapcoSAMDI.Show() End If Catch ex As Exception 'System.Windows.Forms.MessageBox.Show(ex.Message) MsgBox("Enter correct Username and Password", MsgBoxStyle.Critical, "Error Login") End Try
THANKS IN ADVANCE