private void button_extension_Click(object sender, EventArgs e) { try { foreach (DataGridViewRow item in dataGridView1.SelectedRows) { name = item.Cells[1].Value.ToString(); id = Convert.ToInt32(item.Cells[0].Value.ToString()); tuition = Convert.ToInt32(item.Cells[2].Value.ToString()); teacher_id = Convert.ToInt32(item.Cells[3].Value.ToString()); } Subject_Add subject_add = new Subject_Add(); subject_add.Passvalue_id = id; subject_add.Passvalue_name = name; subject_add.Passvalue_num = 1; subject_add.Passvalue_techer = teacher_id; subject_add.Passvalue_tuition = tuition; subject_add.ShowDialog(); } catch (Exception exception) { MessageBox.Show("과목을 선택해주세요", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } string query = "SELECT id as 과목번호, name as 과목명, tuition as 수강료, teacher_id as 강사번호 FROM SUBJECT ORDER BY ID ASC"; OracleDataReader rdr = DBManager.GetInstance().ExecuteReader(query); dataGridView1.DataSource = null; DataTable dt = new DataTable(); dt.Load(rdr); dataGridView1.DataSource = dt; }
private void button_Add_Click(object sender, EventArgs e) { Subject_Add subject_add = new Subject_Add(); subject_add.ShowDialog(); string query = "SELECT id as 과목번호, name as 과목명, tuition as 수강료, teacher_id as 강사번호 FROM SUBJECT ORDER BY ID ASC"; OracleDataReader rdr = DBManager.GetInstance().ExecuteReader(query); dataGridView1.DataSource = null; DataTable dt = new DataTable(); dt.Load(rdr); dataGridView1.DataSource = dt; }