示例#1
0
        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();
                    }
                }
            }
        }
示例#2
0
 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();
             }
         }
     }
 }
示例#3
0
 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();
             }
         }
     }
 }
示例#4
0
 public bool DeleteMeting(Meting m)
 {
     return DBConnect.DeleteMeting(m);
 }
示例#5
0
 public bool AddMeting(Meting m, int missieUID)
 {
     return DBConnect.AddMeting(m, missieUID);
 }
示例#6
0
 public bool UpdateMeting(Meting m)
 {
     return DBConnect.UpdateMeting(m);
 }