private void button7_Click(object sender, EventArgs e) { StudentList stl = new StudentList(); this.Hide(); stl.Show(); }
private void button8_Click(object sender, EventArgs e) { SqlCommand dmd; SqlConnection sqlcon = new SqlConnection(@"Data Source=celsa.database.windows.net;Initial Catalog=pos-mugdho;User ID=celsa;Password=Qwerty1@3$5"); dmd = new SqlCommand(@"delete Registration where StudentID= @StudentID", sqlcon); sqlcon.Open(); dmd.Parameters.AddWithValue("@StudentID", studentId); dmd.ExecuteNonQuery(); sqlcon.Close(); StudentList sl = new StudentList(); sl.Show(); this.Hide(); MessageBox.Show("Record Deleted Successfully"); }
private void button5_Click(object sender, EventArgs e) { SqlCommand cmd, fmd; SqlConnection sqlcon = new SqlConnection(@"Data Source=celsa.database.windows.net;Initial Catalog=pos-mugdho;User ID=celsa;Password=Qwerty1@3$5"); string sql = ""; cmd = new SqlCommand("update Registration set StudentName=@StudentName," + "StudentRollNumber=@StudentRollNumber," + "GuardiansName=@GuardiansName," + "Address=@Address," + "DoB=@DoB," + "School=@School," + "Class=@Class," + "AdmissionFee=@AdmissionFee," + "MobileNumber=@MobileNumber," + "Version=@Version," + "Course=@Course," + "MonthlyFee=@MonthlyFee," + "CourseStartDate=@CourseStartDate," + "Status=@Status," + "RefrenceRollNumber = @RefrenceRollNumber," + "CreatedBy=@CreatedBy where StudentID=@StudentID" , sqlcon); fmd = new SqlCommand(@"update Reference set ReferenceRollNumber = @ReferenceRollNumber where ReferedFor= @ReferedFor", sqlcon); sqlcon.Open(); cmd.Parameters.AddWithValue("@StudentID", studentId); cmd.Parameters.AddWithValue("@StudentName", studentNameTextBox.Text); int rollNumber; if (int.TryParse(RollNumberTextBox.Text, out rollNumber)) { cmd.Parameters.AddWithValue("@StudentRollNumber", rollNumber); fmd.Parameters.AddWithValue("@ReferedFor", rollNumber); } cmd.Parameters.AddWithValue("@GuardiansName", GuardiansNameTextbox.Text); cmd.Parameters.AddWithValue("@Address", AddressTexbox.Text); cmd.Parameters.AddWithValue("@DoB", DateOfBirthPicker.Value); cmd.Parameters.AddWithValue("@School", schoolDropDown.selectedValue); cmd.Parameters.AddWithValue("@Class", classDropdown.selectedValue); cmd.Parameters.AddWithValue("@AdmissionFee", AddmissionFeeDropDown.selectedValue); cmd.Parameters.AddWithValue("@MobileNumber", MobileTextBox.Text); cmd.Parameters.AddWithValue("@Version", VersionDropDown.selectedValue); cmd.Parameters.AddWithValue("@Course", CourseDropDown.selectedValue); cmd.Parameters.AddWithValue("@MonthlyFee", MonthlyFeeDropDown.selectedValue); cmd.Parameters.AddWithValue("@CourseStartDate", bunifuDatepicker3.Value); cmd.Parameters.AddWithValue("@Status", StatusDropdown.selectedValue); cmd.Parameters.AddWithValue("@CreationDate", DateTime.Today); cmd.Parameters.AddWithValue("@CreatedBy", Users.UserID); int referenceRollNumber; if (int.TryParse(ReferenceRollTextBox.Text, out referenceRollNumber)) { cmd.Parameters.AddWithValue("@RefrenceRollNumber", referenceRollNumber); fmd.Parameters.AddWithValue("@ReferenceRollNumber", referenceRollNumber); } else { cmd.Parameters.AddWithValue("@RefrenceRollNumber", referenceRollNumber); fmd.Parameters.AddWithValue("@ReferenceRollNumber", referenceRollNumber); } cmd.ExecuteNonQuery(); fmd.ExecuteNonQuery(); sqlcon.Close(); StudentList sl = new StudentList(); sl.Show(); this.Hide(); MessageBox.Show("Record Updated Successfully"); }