I have the following code, which is meant to show a different page based on the login credentials. Fow example, logging in as admin should show the AdminPanel and logging in as anyone else should show UserPanel. The issues is, no matter who you login as, it shows UserPanel.
Try Dim connection As New SqlClient.SqlConnection Dim command As New SqlClient.SqlCommand Dim adaptor As New SqlClient.SqlDataAdapter Dim dataset As New DataSet connection.ConnectionString = ("Data Source=.\SQLEXPRESS;Initial Catalog=FSMembers;Integrated Security=True;Pooling=False") command.CommandText = "select * from [users] where username='" & UsernameTextBox.Text & "' and password ='" & PasswordTextBox.Text & "' and Position='admin or user' " ' connection.Open() command.Connection = connection adaptor.SelectCommand = command adaptor.Fill(dataset, "0") Dim count = dataset.Tables(0).Rows.Count If count < 1 Then UserPanel.Show() Me.Hide() ElseIf count > 1 Then AdminPanel.Show() Me.Hide() Else MsgBox("You have inserted invalid Login details." & vbNewLine & "Please try again!", MsgBoxStyle.Critical, "Login Failed | FS Members") UsernameTextBox.Clear() PasswordTextBox.Clear() End If Catch ex As System.Data.SqlClient.SqlException MsgBox(ex.Message) End Try
Hope someone can point me in the right direction here.