Beispiel #1
0
        public void EditDB(int ID)
        {
            string tempstr;
            string tempstr1;
            string tempstr2;
            string tempstr3;

            tempstr  = StartDato.ToString("MM/dd/yyyy");
            tempstr1 = tempstr.Substring(0, 2);
            tempstr2 = tempstr.Substring(3, 2);
            tempstr3 = tempstr.Substring(6, 4);
            tempstr  = tempstr2 + "-" + tempstr1 + "-" + tempstr3;


            string sql = "UPDATE Reservationer SET SommerhusID = " + MySommerhusID + ", Dage = '" + Dage + "', StartDato = '" + tempstr + "', Sæson = '" + Sæson + "', KundeTelefon = " + MyKundeTlf + ", Kundenavn = '" + KundeNavn + "', Salgspris = " + Salgspris + " WHERE ReservationID = " + ID;


            try
            {
                SQL.Edit(sql);
            }
            catch (Exception e)
            {
                Console.WriteLine("Der skete en fejl, Reservation er ikke rettet. Fejlkode" + e);
            }
        }
Beispiel #2
0
        public void InsertDB()
        {
            string tempstr;
            string tempstr1;
            string tempstr2;
            string tempstr3;

            tempstr  = StartDato.ToString("MM/dd/yyyy");
            tempstr1 = tempstr.Substring(0, 2);
            tempstr2 = tempstr.Substring(3, 2);
            tempstr3 = tempstr.Substring(6, 4);
            tempstr  = tempstr2 + "-" + tempstr1 + "-" + tempstr3;


            string sql = "INSERT INTO Reservationer VALUES (" + MySommerhusID + "," + Dage + ",'" + tempstr + "','" + Sæson + "'," + MyKundeTlf + ",'" + KundeNavn + "'," + Salgspris + ")";

            try
            {
                SQL.insert(sql);
            }
            catch (Exception e)
            {
                Console.WriteLine("Der skete en fejl, Reservation er ikke oprettet. Fejlkode" + e);
            }
        }