Código:
Podrán ubicarme el problema o ver que falta para que me funcione este problema? Saludos y gracias por tomarse la molestia de leer, espero sus ayudas xD... Dim cn As New SqlConnection(strcn) Dim cmd As New SqlCommand cn.Open() Try sql = "select usu_login,usu_pass from usuarios where usu_login=@usu_login and usu_pass=@usu_pass" cmd = New SqlCommand(sql, cn) cmd.Parameters.AddWithValue("@usu_login", txt_user.Text) cmd.Parameters.AddWithValue("@usu_pass", txt_pass.Text) Dim dr As SqlDataReader = cmd.ExecuteReader 'If dr.HasRows = True Then ' MsgBox("1") 'Else ' MsgBox("2") 'End If If dr.Read = True Then MsgBox("Bienvenido '" & txt_user.Text & "'.") dr.Close() 'prueba a partir de aca sql = "select idnivel from usuarios where usu_login=@usu_login" cmd = New SqlCommand(sql, cn) cmd.Parameters.AddWithValue("@usu_login", txt_user.Text) nivel = cmd.ExecuteScalar() If nivel = 3 Then sql = "select * from niveles where idnivel=@idnivel" cmd = New SqlCommand(sql, cn) cmd.Parameters.AddWithValue("@idnivel", nivel) Dim dr1 As SqlDataReader = cmd.ExecuteReader dr1.Read() Dim principal As New Frm_principal principal.mnu_niveles.Enabled = IIf(dr1(2) = 1, True, False) principal.mnu_usuario.Enabled = IIf(dr1(3) = 1, True, False) principal.mnu_backup.Enabled = IIf(dr1(4) = 1, True, False) principal.mnu_pacientes.Enabled = IIf(dr1(5) = 1, True, False) principal.mnu_medicos.Enabled = IIf(dr1(6) = 1, True, False) principal.mnu_nuevo_usario.Enabled = IIf(dr1(7) = 1, True, False) principal.mnu_nueva_especialidad.Enabled = IIf(dr1(8) = 1, True, False) principal.mnu_visitas.Enabled = IIf(dr1(9) = 1, True, False) principal.mnu_historial.Enabled = IIf(dr1(10) = 1, True, False) 'Call privilegios() MsgBox("Hello") dr1.Close() End If Else MsgBox("Verifique usuario y/o contraseña") txt_user.Clear() txt_pass.Clear() txt_user.Focus() End If Catch ex As Exception MsgBox(ex.Message) Finally cn.Dispose() End Try