private void addTeacherToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Teacher_Form obj = new Teacher_Form();

            obj.Show();
            Visible = false;
        }
Example #2
0
      private void teacherToolStripMenuItem2_Click_1(object sender, EventArgs e)
      {
          Teacher_Form o = new Teacher_Form();

          o.Show();
          this.Hide();
      }
        private void SubmitButton_Click_1(object sender, EventArgs e)
        {
            SqlConnection cnn;

            cnn = new SqlConnection("Server=.\\SQLEXPRESS;Database=DTMS; Integrated Security=true");
            String     Query = "insert into teacher (teacher_id,teacher_name,teacher_dept,teacher_designation,contact_number) values ('" + this.TeacherIdTextBox.Text + "','" + this.TeacherNameTextBox.Text + "', '" + this.TeacherDeptComboBox.Text + "','" + this.TeacherDesignationomboBox.Text + "','" + this.ContactTextBox.Text + "');";
            SqlCommand cmd   = new SqlCommand(Query, cnn);

            //SqlDataReader MyReader;



            cnn.Open();
            cmd.ExecuteReader();
            this.TeacherIdTextBox.Text = string.Empty;
            //MessageBox.Show("Saved", "Result", MessageBoxButtons.OKCancel, MessageBoxIcon.Hand);
            MessageBox.Show("saved");
            Teacher_Form obj = new Teacher_Form();

            obj.Show();
            Visible = false;
        }