private void btn_Add_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(tb_Name.Text)) { MessageBox.Show("도서관 이름을 입력해주세요"); } else { char type = 'A'; switch (comboBox3.SelectedIndex) { case 0: type = 'A'; break; case 1: type = 'B'; break; case 2: type = 'C'; break; case 3: type = 'D'; break; case 4: type = 'E'; break; case 5: type = 'F'; break; case 6: type = 'G'; break; } string cityCode = code.getCityCode(comboBox1.SelectedIndex, comboBox2.SelectedIndex); string libraryCode = code.getLibraryCode(comboBox1.SelectedIndex, comboBox2.SelectedIndex); OracleConnection conn = new OracleConnection(strConn); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "insert into sys_system_code_jh(plant,table_name,description,format_type) values('" + cityCode + "','" + libraryCode + "','" + tb_Name.Text + "','" + type + "')"; cmd.ExecuteNonQuery(); conn.Close(); MessageBox.Show("등록이 완료되었습니다."); form.refresh(); this.Close(); } }
private void btn_Delete_Click(object sender, EventArgs e) { if (MessageBox.Show("삭제하면 모든 정보가 사라집니다.\r정말 삭제하시겠습니까 ?", "삭제", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { OracleConnection conn = new OracleConnection(strConn); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "DELETE FROM sys_system_code_jh WHERE table_name='" + lbCode + "'"; cmd.ExecuteNonQuery(); cmd.CommandText = "DELETE FROM sys_system_code_jh_data WHERE table_name='" + lbCode + "'"; cmd.ExecuteNonQuery(); conn.Close(); this.Close(); form.refresh(); } }