title: How do I get a login form to reject entries with wrong capitalization?
body: <p>I have the following code so far for a login form taking data from a database:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim myconnection As New SqlConnection("server=classified;database=classified")
  myconnection.Open()
  Dim theQuery As String = " SELECT  Username, Password FROM   Accounts WHERE   (Username = '" &amp; TextBox1.Text &amp; "' ) AND (Password = '" &amp; TextBox2.Text &amp; "')"
  Dim repeatChecker As SqlCommand = New SqlCommand(theQuery, myconnection)
  'mycommand.ExecuteNonQuery()
  
  Using reader As SqlDataReader = repeatChecker.ExecuteReader()
      If reader.HasRows Then
          ' User already exists
          While reader.Read()
              If reader("Password") = TextBox2.Text.ToString And reader("Username").ToString = TextBox1.Text Then
                  MessageBox.Show("Logged in successfully as " &amp; TextBox1.Text, "", MessageBoxButtons.OK, MessageBoxIcon.Information)
                  Firs.Show()
                  Me.Close()
                  'Clear all fields
              End If
          End While
      Else
          MessageBox.Show("Invalid username or password.", MsgBoxStyle.Critical)
      End If
  End Using
  myconnection.Close()
  </code></pre>
  
  <p>If I put in the correct login info but with wrong capitalization, I don't get an acceptance or a rejection, the program just sits there and does nothing. How can I get a denial of a login when the capitalization is wrong?</p>