コード例 #1
0
ファイル: Form2.cs プロジェクト: jenalynN/myProject
        private void metroLabel18_Click(object sender, EventArgs e)
        {
            AddSched a = new AddSched();

            a.Show();
            this.Hide();
        }
コード例 #2
0
ファイル: Form2.cs プロジェクト: jenalynN/myProject
        private void pictureBox7_Click(object sender, EventArgs e)
        {
            AddSched a = new AddSched();

            a.Show();
            this.Hide();
        }
コード例 #3
0
ファイル: AddRoom.cs プロジェクト: jenalynN/myProject
        public void add()
        {
            if (metroTextBox1.Text == "")
            {
                MessageBox.Show("Please Complete the Form");
            }
            else if (metroTextBox1.Text != "")
            {
                MySqlConnection conn = new MySqlConnection(myConnection);
                conn.Close();
                conn.Open();
                MySqlCommand command = conn.CreateCommand();
                command.CommandText = "select * from questions where id = '" + metroTextBox1.Text + "'";
                MySqlDataReader read = command.ExecuteReader();

                int count = 0;
                while (read.Read())
                {
                    count++;
                }
                if (count == 1)
                {
                    MessageBox.Show("It seem that the username you want isn't available. Please try another one.");


                    conn.Close();
                }
                else if (count > 1)
                {
                    MessageBox.Show("It seem that the username you want isn't available. Please try another one.'");
                    metroTextBox1.Text = "";

                    conn.Close();
                }
                else
                {
                    conn.Close();
                    conn.Open();
                    MySqlCommand command2 = conn.CreateCommand();

                    command2.CommandText = "insert into room (room) values ( '" + metroTextBox1.Text + "')";
                    command2.ExecuteNonQuery();
                    MessageBox.Show("Successfully Added");
                    conn.Close();

                    metroTextBox1.Text = "";
                    AddSched a = new AddSched();

                    a.Show();
                    this.Hide();
                }
                conn.Close();
            }
        }