Beispiel #1
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int    index     = listBox1.SelectedIndex;
            string studentId = listBox1.Text.ToString();
            string query3    = "DELETE FROM studentRegistral where id = '" + studentId + "' ";
            string query4    = "DELETE FROM log where id = '" + studentId + "' ";

            connection.Close();
            connection.Open();
            //Create Command
            MySqlCommand cmd3 = new MySqlCommand(query3, connection);
            MySqlCommand cmd4 = new MySqlCommand(query4, connection);

            if (MessageBox.Show("Are you sure to delete this data?", "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                //Create a data reader and Execute the command
                cmd3.ExecuteNonQuery();
                cmd4.ExecuteNonQuery();
                MessageBox.Show("Student profile and all of it's record was deleted successfully.");
                Form       form2      = new Form2();
                Pleasewait pleaseWait = new Pleasewait();

                // Display form modelessly
                pleaseWait.Show();

                //  ALlow main UI thread to properly display please wait form.
                Application.DoEvents();

                // Show or load the main form.
                form2.Show();
                this.Hide();
                pleaseWait.Hide();
            }
        }
Beispiel #2
0
        private void btnStudentList_Click(object sender, EventArgs e)
        {
            Form       form2      = new Form2();
            Pleasewait pleaseWait = new Pleasewait();

            // Display form modelessly
            pleaseWait.Show();

            //  ALlow main UI thread to properly display please wait form.
            Application.DoEvents();

            // Show or load the main form.
            form2.Show();
            this.Hide();
            pleaseWait.Hide();
        }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox4.Text != "")
                {
                    string query = "UPDATE studentRegistral SET lastname = '" + textBox1.Text + "', firstname = '" + textBox2.Text + "', middlename = '" + textBox3.Text + "', yearsection = '" + textBox4.Text + "' WHERE id = '" + textBox5.Text + "'";
                    //Open connection
                    connection.Close();
                    connection.Open();
                    //Create Command
                    MySqlCommand cmd = new MySqlCommand(query, connection);

                    //Create a data reader and Execute the command
                    cmd.ExecuteReader();
                    MessageBox.Show("Student profile was updated successfully!");
                    Form       form2      = new Form2();
                    Pleasewait pleaseWait = new Pleasewait();

                    // Display form modelessly
                    pleaseWait.Show();

                    //  ALlow main UI thread to properly display please wait form.
                    Application.DoEvents();

                    // Show or load the main form.
                    form2.Show();
                    this.Hide();
                    pleaseWait.Hide();

                    //close Connection
                    connection.Close();
                }
                else
                {
                    MessageBox.Show("Please fill all fields to processed.");
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.ToString());
            }
        }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form       form2      = new Form2();
            Pleasewait pleaseWait = new Pleasewait();

            // Display form modelessly
            pleaseWait.Show();

            //  ALlow main UI thread to properly display please wait form.
            Application.DoEvents();

            // Show or load the main form.
            form2.Show();
            pleaseWait.Hide();

            //close Connection
            connection.Close();
        }