Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            Welcome_Page login = new Welcome_Page();

            login.ShowDialog();
        }
        private void submitButton_Click(object sender, EventArgs e)
        {
            string fullName    = txtFullName.Text;
            string userName    = txtUserName.Text;
            string pass        = txtPassword.Text;
            string email       = txtEmail.Text;
            string cnic        = txtCnic.Text;
            string confirmPass = txtConfirmPassword.Text;
            string address     = txtAddress.Text;
            string date        = txtDate.Text;
            string contact     = txtContact.Text;

            SqlConnection con = new SqlConnection("Data Source=REHMAN-PC\\SQLEXPRESS;Initial Catalog=UserSignUp;Integrated Security=True");

            con.Open();
            SqlCommand cmd = new SqlCommand("Insert into myAppUsers(fullName,cnic,email,dateOfBirth,contact,address,userName,password) values(@fname,@uCnic,@uEmail,@uDate,@uContact,@uAddress,@uUserName,@uPassword)");

            cmd.Parameters.AddWithValue("@fName", fullName);
            cmd.Parameters.AddWithValue("@uCnic", cnic);
            cmd.Parameters.AddWithValue("@uEmail", email);
            cmd.Parameters.AddWithValue("@uDate", date);
            cmd.Parameters.AddWithValue("@uContact", contact);
            cmd.Parameters.AddWithValue("@uAddress", address);
            cmd.Parameters.AddWithValue("@uUserName", userName);
            cmd.Parameters.AddWithValue("@uPassword", pass);
            cmd.ExecuteNonQuery();

            MessageBox.Show("You have sign-up Successfully");

            this.Hide();
            Welcome_Page signup = new Welcome_Page();

            signup.ShowDialog();
        }