private void button23_Click(object sender, EventArgs e)
        {
            this.Hide();
            Autentificare autentificare = new Autentificare();

            autentificare.Show();
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string utilizator = textBox1.Text;
            string parola     = textBox2.Text;
            string cparola    = textBox3.Text;

            if (utilizator != "" && parola != "" && cparola != "")
            {
                string             q  = "SELECT * FROM utilizatori WHERE Utilizator='" + utilizator + "'";
                DataBaseConnection DB = new DataBaseConnection();
                DB.openConnection();
                conn = DB.getConn();
                MySqlCommand    c  = new MySqlCommand(q, conn);
                MySqlDataReader dr = c.ExecuteReader();
                if (!dr.HasRows)
                {
                    if (parola == cparola)
                    {
                        q = "INSERT INTO utilizatori VALUES (null,'client','" + utilizator + "','" + parola + "')";
                        c = new MySqlCommand(q, conn);
                        dr.Close();
                        c.ExecuteScalar();
                        this.Hide();

                        MessageBox.Show("Contul a fost creat!");
                        Autentificare autentificare = new Autentificare();
                        autentificare.Show();
                    }
                    else
                    {
                        MessageBox.Show("Parolele nu coincid!");
                    }
                }
                else
                {
                    MessageBox.Show("Nume utilizator existent!");
                }
                DB.closeConnection();
            }
            else
            {
                MessageBox.Show("Nu ați completat datele!");
            }
        }