2
Answers

'I need help validating an upper or lower case

JUlius

JUlius

16y
2.9k
1

Hello Everyone:

I need some help setting up a validation to check if the sode is on upper case or lower case

Example: If a user setup the password as MyPassword, and it will be save into the database like that. when the user logs back into the system and types mypassword all lower case, i would like to validate that an invalid password has been enter and not let the user in.

I would like to implement the validation into my code that I already have in place.

Thank you so much for any help I can get

I have the following code:

Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click 

Dim conn As SqlClient.SqlConnection

'connect to DB

conn = New SqlClient.SqlConnection()

conn.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;database=SupportDesk;server='" & Texservername.Text & "'"

'see if connection failed.
Try
conn.Open()
Catch myerror As SystemException
MessageBox.Show("Error Connecting to Database: " & myerror.Message)
End Try

'sql query
Dim myAdapter As New SqlClient.SqlDataAdapter

Dim sqlquery = "SELECT logon, password FROM assignee Where logon='" & UsernameTextBox.Text & "' and password='" & HashPassword(PasswordTextBox.Text) & "'"

Dim myCommand As New SqlClient.SqlCommand()
myCommand.Connection = conn

myCommand.CommandText = sqlquery
'start query
myAdapter.SelectCommand = myCommand

Dim myData As SqlClient.SqlDataReader

myData = myCommand.ExecuteReader()
'see if user exits.

If myData.HasRows = 0 Then
MessageBox.Show("Invalid Login Details", "Login Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
Dim frm1 = New Form
Searchfrm.Show()
Me.Visible = False
End If

End Sub

Answers (2)