Exemplo n.º 1
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            SqlConnection conex = new SqlConnection("Data Source=IVANLOPEZ;Initial Catalog=ADMINPC;User ID=sa;Password=qewebatengo1");

            conex.Open();
            SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From UsuarioAdmin where Nombre='" + txtNombre.Text + "' and RFC='" + txtRFC.Text + "'", conex);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows[0][0].ToString() == "1")
            {
                MessageBox.Show("Bienvenido " + txtNombre.Text);
                MenuAdministrador Menu = new MenuAdministrador();
                Menu.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Verifica tu nombre y RFC");
                txtNombre.Text = "";
                txtRFC.Text    = "";
            }
            conex.Close();
        }