Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //string cs = ConfigurationManager.ConnectionStrings["dbcs"].ConnectionString;

            SqlConnection con   = new SqlConnection(cs);
            string        query = "select * from login_tbl where username = @user and pass = @pass";
            SqlCommand    cmd   = new SqlCommand(query, con);

            cmd.Parameters.AddWithValue("@user", loginUsertextBox.Text);
            cmd.Parameters.AddWithValue("@pass", passwordtextBox.Text);

            con.Open();

            // execute

            SqlDataReader dr = cmd.ExecuteReader();

            // check condition

            if (dr.HasRows == true)
            {
                MessageBox.Show("Login Sucess!");
                username = loginUsertextBox.Text;
                this.Hide();
                frmSale MainForm = new frmSale();
                MainForm.ShowDialog();
            }
            else
            {
                MessageBox.Show("Login Failed!");
            }

            con.Close();
        }
Ejemplo n.º 2
0
        private void btnSale_Click(object sender, EventArgs e)
        {
            frmSale frm = new frmSale();

            frm.TopLevel = false;
            panel3.Controls.Add(frm);

            frm.BringToFront();

            frm.Show();
        }