示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(ConnectionString);

            con.Open();

            SqlCommand exe = new SqlCommand("INSERT INTO AssessmentComponent(Name,RubricId,TotalMarks,DateCreated,DateUpdated,AssessmentId) values('" + txtname.Text + "','" + txtrubricId.Text.ToString() + "','" + txtTotalMarks.Text + "','" + DateTime.Now + "','" + DateTime.Now + "','" + cmbassessmentId.Text.ToString() + "')", con);

            exe.ExecuteNonQuery();
            MessageBox.Show("Added!");

            Form19 frm = new Form19();

            this.Hide();
            frm.Show();
        }
示例#2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(ConnectionString);

            con.Open();



            SqlCommand exe = new SqlCommand("UPDATE AssessmentComponent SET Name = '" + txtname.Text.ToString() + "', RubricId = '" + txtrubricId.Text.ToString() + "', TotalMarks = '" + txtTotalMarks.Text.ToString() + "',AssessmentId='" + cmbassessmentId.Text.ToString() + "' WHERE Id = '" + ID + "' ", con);

            exe.ExecuteNonQuery();

            MessageBox.Show("Edit Successfully!");

            Form19 frm = new Form19();

            this.Hide();
            frm.Show();
        }