Ejemplo n.º 1
0
        private void Registration_Click(object sender, EventArgs e)
        {
            this.Hide();
            Registration_form rf = new Registration_form();

            rf.ShowDialog();
        }
Ejemplo n.º 2
0
        private void Submit_button_Click(object sender, EventArgs e)
        {
            String DateOfBirth  = combo_Day.Text + " " + combo_Month.Text + " " + combo_Year.Text;
            String Student_CGPA = "0";

            if (Text_Student_Name.Text.Length > 1 && Text_Father_Name.Text.Length > 1 && Text_Mother_Name.Text.Length > 1 && Text_Address.Text.Length > 1 && combo_Department.Text.Length > 1 && combo_Program.Text.Length > 1 && DateOfBirth.Length > 1 && combo_Gender.Text.Length > 1 && Text_StudentID.Text.Length > 1 && Text_Studentpass.Text.Length > 1 && Text_StudentConPass.Text.Length > 1)
            {
                SqlConnection  sqlconn = new SqlConnection(@"Data Source=DESKTOP-R54EQ4I;Initial Catalog=Student_Profile;Integrated Security=True");
                String         queary  = "Select * from Student_Registration where Student_ID = '" + Text_StudentID.Text.Trim() + "'";
                SqlDataAdapter sda     = new SqlDataAdapter(queary, sqlconn);
                DataTable      dt      = new DataTable();
                sda.Fill(dt);

                if (dt.Rows.Count == 1)
                {
                    MessageBox.Show("This Student ID Already Exist");
                }
                else
                {
                    if (Text_Studentpass.Text == Text_StudentConPass.Text)
                    {
                        SqlConnection sqlcon = new SqlConnection(@"Data Source=DESKTOP-R54EQ4I;Initial Catalog=Student_Profile;Integrated Security=True");
                        sqlcon.Open();
                        SqlCommand cmd  = new SqlCommand("insert into Student_Registration(Student_Name,Father_Name,Mother_Name,Student_address,Department,Program,Birthday,Gender,cgpa,Student_ID) values('" + Text_Student_Name.Text + "','" + Text_Father_Name.Text + "','" + Text_Mother_Name.Text + "','" + Text_Address.Text + "','" + combo_Department.Text + "','" + combo_Program.Text + "','" + DateOfBirth + "','" + combo_Gender.Text + "','" + Student_CGPA + "','" + Text_StudentID.Text + "')", sqlcon);
                        SqlCommand cmd2 = new SqlCommand("insert into Student_Login values('" + Text_StudentID.Text + "','" + Text_Studentpass.Text + "')", sqlcon);
                        cmd.ExecuteNonQuery();
                        cmd2.ExecuteNonQuery();
                        sqlcon.Close();
                        MessageBox.Show("Registration Successfull");

                        this.Hide();
                        Registration_form rf = new Registration_form();
                        rf.ShowDialog();
                    }

                    else
                    {
                        MessageBox.Show("Password and Confirm don't Match");
                    }
                }
            }
            else
            {
                MessageBox.Show("Fill In The All Information");
            }
        }