private void backToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Adminpanel adp = new Adminpanel();

            adp.Show();
            this.Hide();
        }
예제 #2
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            string uname, password;

            uname    = textBox1.Text;
            password = textBox2.Text;
            SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=F:\database\inventory.mdf;Integrated Security=True;Connect Timeout=30");
            string        qry = "select * from Admindata where username='******' and password='******'";
            SqlCommand    cmd = new SqlCommand(qry, con);

            try
            {
                con.Open();
                SqlDataReader rd = cmd.ExecuteReader();
                if (rd.Read())
                {
                    Adminpanel ad = new Adminpanel();
                    ad.Show();
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Login failed!!!");
                }
            }
            catch (SqlException we)
            {
                Console.WriteLine(we);
            }
        }