private void button_insert_Click(object sender, EventArgs e) { TB_CUST temp = new TB_CUST(); temp.cust_id = textBox1.Text; temp.birth_dt = textBox2.Text; DataManager.tb_custs.Add(temp); DataManager.Save(); DataLoad(); }
public static void Load() { DBHelper_Oracle.Query_Select(); tb_custs.Clear(); foreach (DataRow item in DBHelper_Oracle.ds.Tables[0].Rows) { TB_CUST temp = new TB_CUST(); temp.cust_id = item["CUST_ID"].ToString(); temp.birth_dt = item["BIRTH_DT"].ToString(); tb_custs.Add(temp); } }
private void button_update_Click(object sender, EventArgs e) { try { TB_CUST temp = DataManager_Oracle.tb_custs.Single ((x) => x.cust_id.Trim().ToString() == textBox1.Text); temp.birth_dt = textBox2.Text; DataManager_Oracle.Save(); DataLoad(); } catch (Exception ex) { } }
private void button_delete_Click(object sender, EventArgs e) { try { //싱글은 pk 대상으로 해야 함 //값이 두 개 들어 있으면 catch에서 걸림 TB_CUST temp = DataManager_MySql.tb_custs.Single ((x) => x.cust_id.Trim().ToString() == textBox1.Text); DataManager_MySql.tb_custs.Remove(temp); DataManager_MySql.Save(); DataLoad(); } catch (Exception ex) { } }
private void button_delete_Click(object sender, EventArgs e) { int a = 100; int b = a; b = 1; TB_CUST t = new TB_CUST(); t.cust_id = "a"; t.birth_dt = "b"; TB_CUST t2 = t; t2.cust_id = "c"; // MessageBox.Show(t.cust_id); //Single 사용 방법(람다 써야 함) try { //싱글은 pk 대상으로 해야 함 //값이 두 개 들어 있으면 catch에서 걸림 TB_CUST temp = DataManager.tb_custs.Single ((x) => x.cust_id.Trim().ToString() == textBox1.Text); DataManager.tb_custs.Remove(temp); //이런거 안 됨 //TB_CUST test = new TB_CUST(); //test.cust_id = "aaa"; //test.birth_dt = "bbb"; //DataManager.tb_custs.Remove(test); DataManager.Save(); DataLoad(); } catch (Exception ex) { } }