Пример #1
0
        private void insertData()
        {
            try
            {
                con.Open();
                string qry = "INSERT INTO ExamMarks VALUES('" + tbRegNo.Text + "', @SubjectID ,'" + cbExam.Text + "','" + tbMark.Text + "','" + YearPicker.Value.Year + "')";


                SqlCommand cmd = new SqlCommand(qry, o.con);

                cmd.Parameters.AddWithValue("@SubjectID", cbSubName.SelectedValue);
                cmd.ExecuteNonQuery();
                cmd.Parameters.Clear();
                MessageBox.Show("Record Inserted successfully!!");
                con.Close();

                AddMarks newAdd = new AddMarks();
                this.Hide();
                newAdd.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show("You have already inserted marks for this student or worong id!!!! ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                //MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void BtnAddMarksCRS_Click(object sender, EventArgs e)
        {
            AddMarks am = new AddMarks();

            this.Hide();
            am.ShowDialog();
        }
        private void BtnAddMarksUD_Click(object sender, EventArgs e)
        {
            AddMarks am = new AddMarks();

            am.StartPosition = FormStartPosition.CenterScreen;
            am.ShowDialog();
        }