Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            DonationAdmin donad = new DonationAdmin();

            donad.Show();
            this.Hide();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            sqlCon.Open();
            string        newCom = " Select username, password from useradminTable where username= '******' AND password = '******' ";
            SqlCommand    cmd    = new SqlCommand(newCom, sqlCon);
            SqlDataReader myReader;

            myReader = cmd.ExecuteReader();
            while (myReader.Read())
            {
                string userName = myReader.GetString(0);

                if (textBox1.Text == "admin")
                {
                    DonationAdmin.getUsername = userName;
                    DonationAdmin donad = new DonationAdmin();
                    donad.Show();
                    this.Hide();
                }
                else
                {
                    DonationUser donus = new DonationUser();
                    donus.Show();
                    this.Hide();
                }
            }

            sqlCon.Close();
        }