示例#1
0
        private void consultasToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            Fluxo     Form2    = new Fluxo();
            Consultas newForm3 = new Consultas();

            newForm3.ShowDialog();
        }
示例#2
0
        public void logar()
        {
            sqlConn = new SqlConnection(strConn);
            string usuario, senha;

            try
            {
                usuario = textBox1.Text;
                senha   = textBox2.Text;

                _Sql = "SELECT COUNT (usuario) FROM tbADM WHERE usuario = @usuario AND senha = @senha ";

                SqlCommand comando = new SqlCommand(_Sql, sqlConn);

                comando.Parameters.Add("@usuario", SqlDbType.VarChar).Value = usuario;
                comando.Parameters.Add("@senha", SqlDbType.VarChar).Value   = senha;

                sqlConn.Open();
                int v = (int)comando.ExecuteScalar();

                if (v > 0)
                {
                    this.Visible = false;
                    Consultas Form2    = new Consultas();
                    Consultas newForm3 = new Consultas();
                    newForm3.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Usuario ou senha incorretos");
                }
            }
            catch (SqlException erro)
            {
                MessageBox.Show(erro + "No banco");
            }
        }