Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SqlConnection connn = new SqlConnection(conn);

            connn.Open();
            string     idd  = "Select id from Rubric where Details='" + cmbRubricId.Text.ToString() + "'";
            SqlCommand cmdd = new SqlCommand(idd, connn);
            var        rd   = cmdd.ExecuteReader();

            rd.Read();
            int iddno = rd.GetInt32(0);

            SqlConnection con = new SqlConnection(conn);

            con.Open();
            string     id  = "Select Max(id) from Assessment ";
            SqlCommand cmd = new SqlCommand(id, con);
            var        r   = cmd.ExecuteReader();

            r.Read();
            int idno = r.GetInt32(0);

            string        Query         = "insert into AssessmentComponent(Name ,RubricId,TotalMarks,DateCreated,DateUpdated,AssessmentId) values('" + txtName.Text.ToString() + "','" + iddno + "','" + txtTotalMarks.Text.ToString() + "','" + dtCreated.Value.Date + "','" + dtCreated.Value.Date + "','" + idno + "')";
            SqlConnection myconnection2 = new SqlConnection(conn);
            SqlCommand    MyCommand2    = new SqlCommand(Query, myconnection2);
            SqlDataReader MyReader2;

            myconnection2.Open();
            MyReader2 = MyCommand2.ExecuteReader();
            MessageBox.Show("Data inserted Successfully!");
            Form21 frm5 = new Form21();

            this.Hide();
            frm5.Show();
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form21 frm5 = new Form21();

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