public static bool AddMeting(Meting m, int missieUID) { using (OracleConnection o = new OracleConnection(connstring)) { using (OracleCommand c = new OracleCommand()) { try { c.Connection = o; o.Open(); c.CommandText = "INSERT INTO TMeting (Datum, Locatie, Stof, Waarde) VALUES (to_date('" + m.Datum + "','DD-MM-RR HH24:MI:SS'), '" + m.Locatie + "', '" + m.Stof + "', '" + m.Waarde + "')"; c.ExecuteNonQuery(); c.CommandText = "SELECT MAX(ID) FROM TMeting"; OracleDataReader dr = c.ExecuteReader(); if (dr.Read()) { c.CommandText = "INSERT INTO TMissie_Meting (MissieID, MetingID) VALUES ('" + missieUID + "', '" + GetInt(dr[0]) + "')"; c.ExecuteNonQuery(); } return true; } catch (Exception e) { MessageBox.Show(e.Message); return false; } finally { o.Close(); } } } }
public static bool UpdateMeting(Meting m) { using (OracleConnection o = new OracleConnection(connstring)) { using (OracleCommand c = new OracleCommand()) { try { c.Connection = o; o.Open(); c.CommandText = "UPDATE TMeting SET Datum = to_date('" + m.Datum + "','DD-MM-RR HH24:MI:SS'), Locatie = '" + m.Locatie + "', Stof = '" + m.Stof + "', Waarde = '" + m.Waarde + "' WHERE ID = '" + m.UID + "'"; c.ExecuteNonQuery(); return true; } catch (Exception e) { MessageBox.Show(e.Message); return false; } finally { o.Close(); } } } }
public static bool DeleteMeting(Meting m) { using (OracleConnection o = new OracleConnection(connstring)) { using (OracleCommand c = new OracleCommand()) { try { c.Connection = o; o.Open(); c.CommandText = "DELETE FROM TMeting WHERE ID = '" + m.UID + "'"; c.ExecuteNonQuery(); return true; } catch (Exception e) { MessageBox.Show(e.Message); return false; } finally { o.Close(); } } } }
public bool DeleteMeting(Meting m) { return DBConnect.DeleteMeting(m); }
public bool AddMeting(Meting m, int missieUID) { return DBConnect.AddMeting(m, missieUID); }
public bool UpdateMeting(Meting m) { return DBConnect.UpdateMeting(m); }