コード例 #1
0
        private void btnback_Click(object sender, EventArgs e)
        {
            additionlevel1 frm2 = new additionlevel1(this.txtusername.Text);

            frm2.ShowDialog();
            this.Hide();
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: afwerki12/maths-game
        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");
            }
        }