Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if ((textBox1.Text == string.Empty) || (textBox2.Text == string.Empty) || (comboBox1.Text == string.Empty) || (comboBox2.Text == string.Empty) || (comboBox3.Text == string.Empty) || (comboBox4.Text == string.Empty) || (textBox7.Text == string.Empty) || (comboBox5.Text == string.Empty))
                {
                    MessageBox.Show("Warning:Required empty field:!", "Waring", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    return;
                }
                cn.Open();
                cm = new MySqlCommand("insert into tbllecturer ( id, name, faculty, department, building, center, rank, level) values('" + textBox1.Text + "','" + textBox2.Text + "','" + comboBox1.Text + "','" + comboBox2.Text + "','" + comboBox3.Text + "','" + comboBox4.Text + "','" + textBox7.Text + "','" + comboBox5.Text + "')", cn);
                cm.ExecuteNonQuery();
                cn.Close();
                MessageBox.Show("Record has been successfully saved.", "Lecturer Information", MessageBoxButtons.OK, MessageBoxIcon.Information);


                this.Hide();
                ManageLec f2 = new ManageLec();
                f2.Show();
            }
            catch (Exception ex)
            {
                cn.Close();
                MessageBox.Show("Warning:" + ex.Message, "Waring", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Example #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            ManageLec f3 = new ManageLec();

            f3.Show();
        }