I need to create a Login with user types compulsorily with stored procedures in SQL Server. I have not been able to capture the user type id.
Types of users:
1 = Administrador
2 = Secretaria
3 = Profesional
The stored procedure is:
create procedure ident (@rut varchar(10), @contrasena varchar(30))
as
begin
select ID_TIPO_USUARIO from USUARIO
where RUT_USUARIO = @rut and CONTRASENA = @contrasena
end
And in VisualBasic I have the following
Dim rut, contrasena As String
rut = tbxRut.Text
contrasena = tbxContraseña.Text
Using cnn As SqlConnection = New SqlConnection("Initial Catalog=CONSULTORIO;" & _
"Data Source=DESKTOP-LGTPUJM\SQLEXPRESS;Integrated Security=SSPI;")
Try
cnn.Open()
cmd = New SqlCommand("ident", cnn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@rut", rut)
cmd.Parameters.AddWithValue("@contrasena", contrasena)
cmd.ExecuteNonQuery()
Catch ex As Exception
MsgBox("Error")
End Try
End Using
The stored procedure executes without errors, but I don't know how to capture the query log