private void button3_Click(object sender, EventArgs e) { MainWindow mainwin = (MainWindow)Application.OpenForms["MainWindow"]; mainwin.dispanel.Controls.Clear(); mainwin.dispanel.Visible = false; mainwin.Dashboardpanel.Visible = true; blackfrm blackfrm = (blackfrm)Application.OpenForms["blackfrm"]; blackfrm.Close(); this.Close(); }
public void SaveGrade12() { try { //prepare connection string using (MySqlConnection con = new MySqlConnection(GOCSystem2018.Config.GetConnectionString())) { //try to open connection con.Open(); string sql = "INSERT INTO enrolled_grade_12(regno,gocno,full_name,grade_level,strand,section,semester,SY_enrolled) " + " VALUES (@regNo,@theGOCNo,@fullName,@gradeLevel,@strand,@section,@semester,@syEnroll);"; MySqlCommand cmd = new MySqlCommand(sql, con); cmd.Parameters.AddWithValue("regNo", regNo); cmd.Parameters.AddWithValue("TheGOCNo", theGOCNo); cmd.Parameters.AddWithValue("fullName", fullName); cmd.Parameters.AddWithValue("gradeLevel", gradeLevel); cmd.Parameters.AddWithValue("strand", strand); cmd.Parameters.AddWithValue("section", section); cmd.Parameters.AddWithValue("semester", semester); cmd.Parameters.AddWithValue("syEnroll", syEnroll); cmd.ExecuteNonQuery(); blackfrm blackfrm = new blackfrm(); blackfrm.ShowDialog(); //MessageBox.Show("Record Saved!", "GOCINFOSYS", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (MySqlException ex) { MessageBox.Show("ERROR : " + ex.ToString(), "GOCINFOSYS", MessageBoxButtons.OK, MessageBoxIcon.Error); } }