What should i do to make this case sensitive?
When I try this code with input in different cases but with the same spelling of username and password, it still logs in. My fields are all varchar in database.
if (user_txt.Text != "" & pass_txt.Text != "")
{
string queryText = "SELECT Count(*) FROM stiguidancesample.users " + "WHERE username = @Username AND password = @Password";
MySqlConnection cn = new MySqlConnection(MyConnectionString);
MySqlCommand cmd = new MySqlCommand(queryText, cn);
{
cn.Open();
cmd.Parameters.AddWithValue("@Username", user_txt.Text); // cmd is SqlCommand
cmd.Parameters.AddWithValue("@Password", pass_txt.Text);
int result = Convert.ToInt32(cmd.ExecuteScalar());
if (result > 0)
MessageBox.Show("Loggen In!");
else
MessageBox.Show("User Not Found!");
}
}