示例#1
0
        private void button3_Click(object sender, EventArgs e)
        {
            this.Hide();
            step22 ss = new step22();

            ss.Show();
        }
示例#2
0
        private void loginbutton_Click(object sender, EventArgs e)
        {
            string          userName = txtusername.Text;
            MySqlConnection con      = new MySqlConnection("datasource= localhost; database=voter;port=3306; username = root;"); //open connection

            con.Open();
            MySqlCommand    cmd    = new MySqlCommand("select * from users where username = '******' AND password = '******'", con);
            MySqlDataReader reader = cmd.ExecuteReader();

            if (reader.Read())
            {
                if (userName == "anik")
                {
                    MessageBox.Show("Password Correct");
                    this.Hide();
                    step2 view2 = new step2();
                    view2.Show();
                }
                else if (userName == "admin")
                {
                    MessageBox.Show("Password Correct");
                    this.Hide();
                    step22 view2 = new step22();
                    view2.Show();
                }
            }
            else
            {
                MessageBox.Show("Username or password incorrect");
                reader.Close();
                txtusername.Text = string.Empty;
                txtpassword.Text = string.Empty;
                cmd.Dispose();
                con.Close();
            }
        }