Example #1
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            AdminPanel a1 = new AdminPanel();

            a1.Show();
            this.Hide();
        }
        private void bunifuButton1_Click(object sender, EventArgs e)
        {
            try
            {
                Aname = txt3.Text;
                pword = txt5.Text;

                SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=D:\Databases\37Srinko.mdf;Integrated Security=True;Connect Timeout=30");
                string        qry = "select * from SignUp where username='******' AND  password='******'";

                SqlCommand cmd = new SqlCommand(qry, con);

                try
                {
                    if (Aname == "DeepalA" && pword == "da123")
                    {
                        con.Open();
                        cmd.ExecuteNonQuery();

                        AdminPanel ap = new AdminPanel();
                        ap.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("Incorecct Username and Password");
                        txt3.Text = "";
                        txt5.Text = "";
                    }
                }
                catch (SqlException se)
                {
                    MessageBox.Show("" + se);
                }
            }
            catch (SqlException es)
            {
                MessageBox.Show("" + es);
            }
        }