예제 #1
0
        private void BtnEntrar_Click(object sender, EventArgs e)
        {
            String        conn_string = (@"Data Source=RAUL-PC;Initial Catalog=BDRESTAURANTE;Integrated Security=True");
            SqlConnection con         = new SqlConnection(conn_string);

            con.Open();
            DataTable      dados = new DataTable();
            SqlDataAdapter da    = new SqlDataAdapter("SELECT * FROM USUARIO WHERE USUARIO=@USUARIO AND SENHA=@SENHA", con);

            da.SelectCommand.Parameters.AddWithValue("@USUARIO", TxtLogin.Text);
            da.SelectCommand.Parameters.AddWithValue("@SENHA", TxtSenha.Text);
            da.Fill(dados);
            con.Close();
            if (dados.Rows.Count == 0)
            {
                MessageBox.Show("Usuario/Senha invalidos");
            }
            else
            {
                MessageBox.Show("Seja bem vindo ao sistema!!!");
                Menuprincipal Menuprincipal = new Menuprincipal();
                Menuprincipal.Show();
                this.Hide();
            }
            TxtLogin.Text = "";
            TxtSenha.Text = "";
        }
예제 #2
0
        public MainController()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            m = new Menuprincipal();

            //

            Application.Run(m);
        }