Exemple #1
0
        private void rellenaComboAutores()
        {
            MySqlConnection conexion = new ConexionBBDD().conecta();
            MySqlCommand    comando  =
                new MySqlCommand("Select * from actors order by first_name", conexion);
            MySqlDataReader resultado = comando.ExecuteReader();

            while (resultado.Read())
            {
                String id         = resultado.GetString(0);
                String first_name = resultado.GetString("first_name");
                String last_name  = resultado.GetString("last_name");
                String gender     = resultado.GetString("gender");
                String film_count = resultado.GetString("film_count");

                desplegableActores1.Items.Add(id + "--" + first_name + "--" + last_name);
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            MySqlConnection conexion = new ConexionBBDD().conecta();

            MySqlCommand comando = new MySqlCommand("" +
                                                    "Select * FROM usuarios WHERE " +
                                                    "usuario = '" + textBox1.Text +
                                                    "'And pass = '******';", conexion);
            MySqlDataReader resultado = comando.ExecuteReader();

            if (resultado.Read())
            {
                MessageBox.Show("Acceso Correcto", "Usuario OK");
                this.Visible = false; //oculta la ventana de login
                VentanaPrincipal v = new VentanaPrincipal();
                v.Visible = true;     // o tamb v.show = true;
            }
            else
            {
                MessageBox.Show("Usuario Y/O contrseña incorrecto(s)", "ERROR");
            }
        }