Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
            Prijava p = new Prijava();

            p.Show();
        }
Beispiel #2
0
        private void registracijaButton_Click(object sender, EventArgs e)
        {
            MySqlConnection conn = new MySqlConnection(dbConnectionString);

            conn.Open();

            string          query  = "SELECT * FROM uporabniki WHERE upor_ime = '" + uporImeTextBox.Text + "' AND geslo = '" + gesloTextBox.Text + "';";
            MySqlCommand    comm   = new MySqlCommand(query, conn);
            MySqlDataReader reader = comm.ExecuteReader();

            int st = 0;

            while (reader.Read())
            {
                st++;
            }
            if (st > 0)
            {
                MessageBox.Show("Uporabniško ime že obstaja!");
            }
            else
            {
                reader.Close();
                string       insert  = "INSERT INTO uporabniki (upor_ime, geslo) VALUES ('" + uporImeTextBox.Text + "', '" + gesloTextBox.Text + "');";
                MySqlCommand command = new MySqlCommand(insert, conn);
                command.ExecuteNonQuery();
                MessageBox.Show("Uporabnik uspešno kreiran!");
                this.Close();
                Prijava p = new Prijava();
                p.Show();
            }
        }