Ejemplo n.º 1
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     try
     {
         string date = monthCalendar1.SelectionStart.ToShortDateString();
         if (MessageBox.Show("Are you sure you want to add this message?", "Insert to DataBase", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
         {
             db.InsertContstraints(GlobalVariables.User_ID, Days.Text, StartHours.Text, EndHours.Text, Notes.Text, date, Semester.Text, Course.Text);
             this.Hide();
             main m = new B_8.main();
             m.Show();
         }
     }
     catch (Exception exp)
     {
         MessageBox.Show("Colud not connect to sql");
     }
     finally
     {
         if (db.isconnected == true)
         {
             db.CloseConnection();
         }
     }
 }