Example #1
0
        //public String Lecture1, Lecture2, SubjectCode, SubjectName, GroupID, Tag, NoOfStudent, Duration;

        private void btnSave_Click(object sender, EventArgs e)
        {
            S.Lecture1    = cmbSelectLec.Text;
            S.Lecture2    = txtSelectLec.Text;
            S.SubjectCode = txtSubCode.Text;
            S.SubjectName = cmbSelectSubject.Text;
            S.GroupID     = cmbSelectGroup.Text;
            S.Tag         = cmbSelectTag.Text;
            S.NoOfStudent = txtNoStudent.Text;
            S.Duration    = txtDuration.Text;

            //inserting Data into database using the method we created

            bool success = S.insertSession(S);

            if (success == true)
            {
                //successfully inserted
                MessageBox.Show("Successfully Inserted");

                //call the method here
                Clear();
            }
            else
            {
                //failed to add data
                MessageBox.Show("Failed to add Session details.Try Again");
            }
        }