etjohnson81
Programmer
The code below is what I am using to determine if credentials were good.
When the table has records (hasrows = true)... The Login Success is shown.
When there are no records (hasrows = false)...Nothing is displayed.
I had this working previously with slightly different code that used a Count(*) in the SQL String, but I would like to run only one SQL read if possible.
Anyone know why this might not work?
Travis
Code:
Try
While sqlOutput.Read
If sqlOutput.HasRows = False Then
lblErrorMessage.Text = "You don't have access to this site. Please contact your administrator."
lblErrorMessage.Visible = True
End If
If sqlOutput.HasRows = True Then
lblErrorMessage.Text = "Login Success"
lblErrorMessage.Visible = True
'Load user information
End If
End While
Catch ex As Exception
lblErrorMessage.Text = "An Error Occured During Login"
End Try
When the table has records (hasrows = true)... The Login Success is shown.
When there are no records (hasrows = false)...Nothing is displayed.
I had this working previously with slightly different code that used a Count(*) in the SQL String, but I would like to run only one SQL read if possible.
Anyone know why this might not work?
Travis