Exemplo n.º 1
0
        private void btnback_Click(object sender, EventArgs e)
        {
            additionlevel1 frm2 = new additionlevel1(this.txtusername.Text);

            frm2.ShowDialog();
            this.Hide();
        }
Exemplo n.º 2
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            SqlConnection  con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=
C:\Users\afexg\OneDrive\Documents\Data.mdf;Integrated Security=True;Connect Timeout=30");
            SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) From Login where UserName = '******' and Password = '******'", con);

            DataTable dt = new DataTable();

            sda.Fill(dt);
            if (dt.Rows[0][0].ToString() == "1")
            {
                //to pass the data from one page to another
                additionlevel1 frm2 = new additionlevel1(this.txtusername.Text);
                frm2.ShowDialog();
                this.Hide();
            }
            else
            {
                MessageBox.Show("CHECK your user name or password");
            }
        }