I have this simple code to enter a system I would like to know if through this same code there is any way of asking if the type of user that I select is administrator, etc. to perform certain actions?
this is the code:
Private Sub btningresar_Click(sender As Object, e As EventArgs) Handles btningresar.Click
Dim conn As New SqlClient.SqlConnection("Data Source=SAMUELSUSANA; Initial catalog=poovb;integrated security=true")
Dim dr As SqlDataReader
'Dim da As SqlDataAdapter
Dim ds As New DataSet
'Dim dt As DataTable
Try
conn.Open()
Dim cmd As New SqlCommand("Select * from Usuario where Usuario='" & Me.txtusuario.Text & "'and Clave='" & Me.txtcontraseña.Text & "'and Tipo= '" & Me.cbtipo.Text & "'", conn)
dr = cmd.ExecuteReader
If (dr.HasRows = True) Then
MessageBox.Show("Bienvenido al Sistema Señor/a..." + txtusuario.Text)
Me.Hide()
MenuPrincipal.Show()
ElseIf (dr.HasRows = False) Then
MessageBox.Show("Usuario y/o Contraseña Erronea, Por favor intente de nuevo.")
txtusuario.Clear()
txtcontraseña.Clear()
cbtipo.Text = ""
txtusuario.Focus()
conteo = conteo + 1
If (conteo = 3) Then
MessageBox.Show("Ha alcanzado el limite de intentos, Vuelva a intentarlo mas tarde con datos correctos.")
Application.Exit()
End If
End If
Catch Exoledb As Exception
Finally
conn.Close()
End Try