예제 #1
0
파일: Form21.cs 프로젝트: OaAdraza/ProjectB
        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();
        }
예제 #2
0
파일: Form22.cs 프로젝트: OaAdraza/ProjectB
        private void button1_Click(object sender, EventArgs e)
        {
            Form21 frm5 = new Form21();

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