private void buttonBack_Click(object sender, EventArgs e)
        {
            OwnerHome f1 = new OwnerHome();

            f1.Show();
            this.Hide();
        }
Exemplo n.º 2
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            SqlConnection  con   = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=I:\C# Project\CoffeeShop\CoffeeShop\CoffeeShop.mdf;Integrated Security=True");
            string         query = "Select * from Admin WHERE Id= '" + textBoxUserId.Text.Trim() + "' and Password = '******'";
            SqlDataAdapter sda   = new SqlDataAdapter(query, con);
            DataTable      dtbl  = new DataTable();

            sda.Fill(dtbl);
            if (dtbl.Rows.Count == 1)
            {
                OwnerHome f1 = new OwnerHome();
                f1.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Check your User Id or Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }