コード例 #1
0
        private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Hide();
            FrmLogIn obj = new FrmLogIn();

            obj.Show();
        }
コード例 #2
0
        private void BtnAdmin_Click(object sender, EventArgs e)
        {
            FrmLogIn f = new FrmLogIn();

            f.Show();
            this.Hide();
        }
コード例 #3
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            string username, password, cpassword;

            username  = TbUserName.Text;
            password  = TbPw.Text;
            cpassword = TbCPw.Text;
            if (username == "" || password == "" || cpassword == "")
            {
                MessageBox.Show("All the data must be filled");
            }
            else if (password != cpassword)
            {
                MessageBox.Show("Mismatched Password \n Both Password must match!!!");
            }
            else
            {
                string     chkUser = "******" + TbUserName + "'";
                SqlCommand cmd     = new SqlCommand(chkUser, Con);
                //cmd.Parameters.AddWithValue("@un", TbUserName.Text);
                Con.Open();
                SqlDataReader data = cmd.ExecuteReader();
                if (data.HasRows)
                {
                    MessageBox.Show("UserName already Exist");
                    TbCPw.Clear();
                    TbPw.Clear();
                    TbUserName.Clear();
                }
                else
                {
                    Con.Close();
                    string     insertQuery = "Insert into TblUser values('" + username + "','" + password + "')";
                    SqlCommand cmd1        = new SqlCommand(insertQuery, Con);
                    Con.Open();
                    cmd1.ExecuteNonQuery();
                    MessageBox.Show("ID registered successfully");
                    Hide();
                    FrmLogIn obj = new FrmLogIn();
                    obj.Show();
                }
                Con.Close();
            }
        }