Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
I am having problem with username string matching ie Upper or lower case.It is accepting username in Small also and in caps alsO and Its accepting the space too !!! whenever i am providing the correct username and password.
I am giving u here the code ,pls reply with correct answer.
private void btnSubmit_Click(object sender, EventArgs e)
SqlConnection con = new SqlConnection("connection string");
str=("Select * from Logins where Username='"+txtUsername.Text+"' and Password='"+txtPassword.Text+"' ");
SqlCommand cmd = new SqlCommand(str,con);
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
if (((dt.Rows.Count > 0)&&(txtUsername.Text!=txtUsername.Text.ToLower()))&&(txtPassword.Text!=txtPassword.Text.ToUpper()))
0 · ·