I have stored userid and password in mysql database, this query is showing login successfully for not stored data, so please correct it
string query = "select * from login where userid=@userid and password=@password"; using (MySqlCommand cmd = new MySqlCommand(query)) { cmd.Parameters.AddWithValue("@userid", id); cmd.Parameters.AddWithValue("@password", password); cmd.Connection = cnn; cnn.Open(); cmd.ExecuteNonQuery(); DialogResult dr = MessageBox.Show("Are you sure to Login now?", "Confirmation Message", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { MessageBox.Show("Login Successfully"); cnn.Close(); this.Hide(); Form2 f2 = new Form2(); f2.ShowDialog();