I have created a simple program with log in form. It works in a very simple way but I observed that when logging in, it is not case sensitive. For example if my username is Test
and I would log in using test
it would still be accepted.
SqlConnection connect = new SqlConnection("Data Source=LAFAYETTE-PC;Initial Catalog=Thesis;Integrated Security=True");
connect.Open();
SqlCommand command = new SqlCommand("SELECT * FROM AdminCredentials WHERE Username = '" + LogInUsername.Text + "' AND Password = '" + LogInPassword.Text + "' ", connect);
SqlDataReader reader;
reader = command.ExecuteReader();
int count = 0;
while (reader.Read())
{
count += 1;
}
if (count == 1)
{
MessageBox.Show("Successfully Logged In!");
MainForm form2 = new MainForm();
form2.ShowDialog();
}
else if (count > 0)
{
MessageBox.Show("Incorrect username and passsword");
}
else
{
MessageBox.Show("Username or password is incorrect");
}
any ideas? Help would be greatly appreciated!