private void button3_Click(object sender, EventArgs e) { try { if ((textBox4.Text == string.Empty) || (textBox2.Text == string.Empty) || (textBox1.Text == string.Empty) || (comboBox2.Text == string.Empty) || (comboBox6.Text == string.Empty) || (comboBox5.Text == string.Empty) || (textBox3.Text == string.Empty) || (comboBox3.Text == string.Empty)) { MessageBox.Show("Warning:Required empty field:!", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } cn.Open(); cm = new MySqlCommand("insert into tblsession ( sid, lec1, lec2, tag, groupid, subject, studentno, duration) values('" + textBox4.Text + "','" + textBox2.Text + "','" + textBox1.Text + "','" + comboBox2.Text + "','" + comboBox6.Text + "','" + comboBox5.Text + "','" + textBox3.Text + "','" + comboBox3.Text + "')", cn); cm.ExecuteNonQuery(); cn.Close(); MessageBox.Show("Record has been successfully saved.", "Session Information", MessageBoxButtons.OK, MessageBoxIcon.Information); Clear(); this.Hide(); ManageSession f2 = new ManageSession(); f2.Show(); } catch (Exception ex) { cn.Close(); MessageBox.Show("Warning:" + ex.Message, "Waring", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void button10_Click(object sender, EventArgs e) { ManageSession f3 = new ManageSession(); f3.Show(); }