Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            MySqlConnection conectar = new MySqlConnection("server=127.0.0.1;database=proyecto;Uid=root;");

            conectar.Open();
            MySqlCommand    codigo     = new MySqlCommand();
            MySqlConnection conectanos = new MySqlConnection();

            codigo.Connection  = conectar;
            codigo.CommandText = ("select * from usuarios where matricula ='" + textBoxusuario.Text + "' and pass= '******'");
            MySqlDataReader leer = codigo.ExecuteReader();

            if (leer.Read())
            {
                MessageBox.Show("Bienvenido administrador");
                INICIO_SESION_ADMINISTRADOR llamar = new INICIO_SESION_ADMINISTRADOR();
                llamar.Show();
                this.Hide();
            }

            else
            {
                MessageBox.Show("Usuario incorrecto");
            }

            conectar.Close();
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            //CREAMOS LA INSTANCIA DEL FORMULARIO
            INICIO_SESION_ADMINISTRADOR obj = new INICIO_SESION_ADMINISTRADOR();

            //LLAMAMOS EL OBJETO Y LO PONEMOS VISIBLE
            obj.Visible = true;
            //OCULTAMOS
            Visible = false;
        }